Opened 15 years ago
Closed 13 years ago
#2947 closed defect (fixed)
Segmentation fault when using imagemode "INT16" in mapfile
Reported by: | bokhorst | Owned by: | warmerdam |
---|---|---|---|
Priority: | normal | Milestone: | |
Component: | GDAL Support | Version: | 5.2 |
Severity: | normal | Keywords: | outputformat |
Cc: | tbonfort |
Description
Originally I had a problem using a PNG file having 16 bits per color band as a raster layer in
MapServer because it was converted to a 8-bit per band PNG on output.
So I tried specifying an OUTPUTFORMAT with IMAGEMODE "INT16". This caused a segmentation fault with both shp2img and mapserv.
On further testing it appeared that the error can be reproduced without having a layer at all. Additionally, when minimizing the mapfile for this bug report I got another error when setting the LEGEND status to anything other than EMBED or removing it altogether. The result is included below.
Attached is the mapfile (I also attached the PNG image that I was trying to use as a reference).
I have built MapServer from source. Here the mapserv -v output:
MapServer version 5.2.0 OUTPUT=GIF OUTPUT=PNG OUTPUT=JPEG OUTPUT=WBMP OUTPUT=SVG SUPPORTS=PROJ SUPPORTS=AGG SUPPORTS=FREETYPE SUPPORTS=ICONV SUPPORTS=WMS_SERVER SUPPORTS=WMS_CLIENT SUPPORTS=WFS_SERVER SUPPORTS=WFS_CLIENT SUPPORTS=WCS_SERVER SUPPORTS=SOS_SERVER SUPPORTS=GEOS INPUT=EPPL7 INPUT=POSTGIS INPUT=OGR INPUT=GDAL INPUT=SHAPEFILE
TESTS
1. Using my OUTPUTFORMAT with INT16:
$ shp2img -m sixteenbittest.map -s 800 600 -o test.png Segmentation fault
Log file is empty, test.png file not created
2. Overriding OUTPUTFORMAT on command line:
$ shp2img -m sixteenbittest.map -s 800 600 -o test.png -i png
All okay.
3. Legend status OFF in mapfile, using INT16:
$ shp2img -m sixteenbittest.map -s 800 600 -o test.png gd-png: fatal libpng error: Image width or height is zero in IHDR gd-png error: setjmp returns error condition
test.png is created but empty.
4. Legend status OFF in mapfile, overriding OUTPUTFORMAT:
$ shp2img -m sixteenbittest.map -s 800 600 -o test.png -i png
All okay.
Attachments (3)
Change History (10)
by , 15 years ago
Attachment: | sixteenbittest.map added |
---|
comment:1 by , 15 years ago
In case it matters: I compiled and tested mapserver on Ubuntu 7.10 with libpng 1.2 (version 1.2.15~beta5-2ubuntu0.1)
comment:2 by , 15 years ago
Cc: | added |
---|---|
Status: | new → assigned |
comment:3 by , 13 years ago
Component: | MapServer C Library → GDAL Support |
---|
comment:4 by , 13 years ago
Cc: | removed |
---|---|
Owner: | changed from | to
Status: | assigned → new |
comment:6 by , 13 years ago
"Investingating" - I've invented a new word!
I find the problem still exists in 5.6 but not trunk. I'll try to patch 5.6 branch since this may well be in use for a while.
comment:7 by , 13 years ago
Keywords: | outputformat added |
---|---|
Resolution: | → fixed |
Status: | assigned → closed |
I have determined that the mechanisms for validating outputformat objects has changed non-trivially in trunk and backporting the changes is somewhat risky. I am going to leave things as they are. So this bug will continue to manifest in 5.6 branch but it only occurs in the illegal case of using "raw modes" with non-GDAL drivers. In trunk we see the following:
warmerda@gdal65[54]% shp2img -m sixteenbittest.map -o out.png -s 800 600msOutputFormatValidate(): General error message. OUTPUTFORMAT mypng has IMAGEMODE BYTE/INT16/FLOAT32, but this is only supported for GDAL drivers. <br>
Thanks for the report - sorry for not acting on it sooner.
Map file