[Gdal-dev] Safety check needed for png read
ben at vterrain.org
Tue Aug 24 23:28:11 EDT 2004
While in the png code (chasing GDAL crashes) i found that it calls libpng in
a very unsafe manner, not checking for failure. We really need something
like this in pngdatset.cpp:
poDS->hPNG = png_create_read_struct(...);
if (poDS->hPNG == NULL)
int version = png_access_version_number();
CPLError( CE_Failure, CPLE_NotSupported,
"The PNG driver failed to access libpng with version '%s',"
" library is actually version '%d'.\n",
This will informatively catch the situation where the libpng libraries and
headers are out of sync, which is quite easy to get when wrangling with
library versioning issues, as i have been for the past 5 hours.
More information about the Gdal-dev