Opened 16 years ago

Last modified 16 years ago

#1136 closed defect (fixed)

PNGDataset::Open(...) crash when it fails

Reported by: list672000@… Owned by: warmerdam
Priority: high Milestone:
Component: GDAL_Raster Version: unspecified
Severity: normal Keywords:


In PNGDataset::Open(...), if "poDS->hPNG = png_create_read_struct(...)" results 
in poDS->hPNG being NULL, then there is a "delete poDS;" which calls ~PNGDataset
().  In ~PNGDataset(), there is a "png_destroy_read_struct(&hPNG, ...);" which 
seems to crash when hPNG is NULL (using libpng-1.2.8's png_destroy_read_struct

It might be crashing on the libpng's png_destroy_read_struct's "free_fn = 
png_ptr->free_fn" line.

Maybe ~PNGDataset() could be changed to check if hPNG is NULL before calling 

Change History (1)

comment:1 by warmerdam, 16 years ago

I have modified the code to not png_destroy_read_struct() the 
hPNG if it is NULL.

Let me know if you still see any problems. 

Note: See TracTickets for help on using tickets.