#2682 closed defect (fixed)
GDALWriteWorldFile : NULL to derive world-file extension from the pszBaseFilename crashes
Reported by: | gislab | Owned by: | Even Rouault |
---|---|---|---|
Priority: | normal | Milestone: | 1.6.0 |
Component: | GDAL_Raster | Version: | unspecified |
Severity: | normal | Keywords: | |
Cc: |
Description
Documentation says (http://www.gdal.org/gdal_8h.html#dae2ed5807e4ec288812b54c6fccda1e), that it is possible to pass NULL to GDALReadWorldFile to derive it from the filename. Seems like this is not the case for GDALWriteWorldFile (no docs) and passing NULL crashes GDAL.
May be adding something like this would help:
if (pszExtension != NULL)
pszTFW = CPLResetExtension( pszBaseFilename, pszExtension );
else
pszTFW = pszBaseFilename;
-Maxim
Change History (4)
comment:1 by , 15 years ago
Component: | default → GDAL_Raster |
---|---|
Milestone: | → 1.6.0 |
Owner: | changed from | to
Status: | new → assigned |
follow-up: 3 comment:2 by , 15 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
comment:3 by , 15 years ago
comment:4 by , 15 years ago
Because there are many possible extensions depending on the use. For the read case we can try different patterns (for example for a PNG raster : wld, pgw, pngw), but for the write case, the user must specify the one that he really wants.
In r15744, I've added doc for GDALWriteWorldFile to specify that pszExtension must not be NULL. VALIDATE_POINTER1 also added to check it.