Opened 22 years ago

Closed 22 years ago

Last modified 22 years ago

#235 closed defect (fixed)

[GDAL] GIF image fails to load in GDAL

Reported by: dmorissette Owned by: warmerdam
Priority: high Milestone:
Component: GDAL Support Version: 4.0
Severity: normal Keywords: VERIFIED
Cc:

Description

We ran into a WMS layer that crashes GDAL.  Well, it doesn't really carsh, it
aborts with an unrecoverable error.

The following WMS request (with invalid BBOX) produces an image with an error
message (looks cool BTW :)

http://globe.digitalearth.gov/viz-bin/wmt.cgi?SERVICE=WMS&VERSION=1.0.7&LAYERS=COASTLINES&FORMAT=image/gif&STYLES=default&TRANSPARENT=TRUE&REQUEST=GetMap&WIDTH=400&HEIGHT=300&SRS=EPSG:4326&BBOX=-190,-145.713000,190,139.412000&EXCEPTIONS=INIMAGE

This WMS request causes MapServer to abort with "premature end of script
headers" as it tries to reproject the image via GDAL.

The error can also be reproduced with 'gdal_translate':

$ gdal_translate -of GTiff brokengif.gif brokengif.tiff

Size is 400, 300
ERROR 5: GDALDataset::GetRasterBand(1) - Illegal band #

Aborted

Frank, can you please have a look?

Change History (2)

comment:1 by fwarmerdam, 22 years ago

Resolution: fixed
Status: newclosed
It seems that gif files have a "screen description" and then a series of
"image descriptions".  Previously, the screen description was used to establish
the size of the GDAL dataset, and any images that didn't match were discarded.

For reasons I don't understand the screen description of the given file was
400x300 while the image itself was described as 399x300.  I have changed the
code to use the size of the first image layer as the dataset size and now the
image works fine. 

Change to gdal/frmts/gif/gifdataset.cpp committed in CVS.

This bug report should likely have been filed in the GDAL bugzilla.  

comment:2 by dmorissette, 22 years ago

Keywords: VERIFIED added
Verified.  Works great now!  Thanks!
(And I'll try to post further GDAL-specific bugs in the GDAL bugzilla. :)
Note: See TracTickets for help on using tickets.