Opened 14 years ago
Closed 14 years ago
#3399 closed defect (fixed)
Crash in GRIB reader when file open fails
Reported by: | gaige | Owned by: | gaige |
---|---|---|---|
Priority: | normal | Milestone: | 1.7.2 |
Component: | GDAL_Raster | Version: | 1.7.0 |
Severity: | normal | Keywords: | grib |
Cc: | warmerdam |
Description
The result of the file open isn't checked. Added this check
frmts/grib/gribdataset.cpp: 491a492,504
/* check return values and gracefully fail */ if (!poDS->fp) {
we have no FP, so we don't have anywhere to read from
char * errMsg = errSprintf(NULL); if( errMsg != NULL )
CPLDebug( "GRIB", "%s", errMsg );
free(errMsg);
CPLError( CE_Failure, CPLE_OpenFailed, "Error (%d) opening file %s", errno, poOpenInfo->pszFilename);
delete poDS; return NULL; }
Change History (4)
comment:1 by , 14 years ago
comment:2 by , 14 years ago
Cc: | added |
---|---|
Component: | default → GDAL_Raster |
Keywords: | grib added |
Owner: | changed from | to
This change looks fine. I'm not certain when we would get to this point and still not be able to open the file.
comment:3 by , 14 years ago
I can try and find my particular test that crashed here, but I believe it was when I did a driver-specific open on the file. However, I reached this point in the code, which is why I changed it on my source.
-Gaige
Once more with the diff