Opened 12 years ago
Last modified 12 years ago
#4603 closed defect
Possible bug in FileDataSource::DataSourceFgetc() — at Version 2
Reported by: | larrybiehl | Owned by: | warmerdam |
---|---|---|---|
Priority: | normal | Milestone: | 1.9.1 |
Component: | GDAL_Raster | Version: | unspecified |
Severity: | normal | Keywords: | grib |
Cc: |
Description (last modified by )
Not sure of the logic in the following routine in filedatasource.cpp in degrib directory. A character is read from the grib file apparently to test whether it is at the end of the file. EOF is returned if there is an error in reading a character. But if the character read in the file is equal to EOF, the reading of valid data stops. I have a NLDAP grib file with 37 data sets in it. It stop after 9 because a character read with this routine happens to be -1. I did a check of chData to see if it was equal to EOF and set chData to 0 instead. The grib file was read correctly. I was able to access all 37 data sets. Is there a reason for chData at this point to indicate a badly formed grib file if the value return here is -1?
int FileDataSource::DataSourceFgetc() { char chData; if( VSIFReadL( &chData, 1, 1, fp ) == 1 ) return chData; else return EOF; }
Change History (2)
comment:1 by , 12 years ago
Description: | modified (diff) |
---|
comment:2 by , 12 years ago
Component: | default → GDAL_Raster |
---|---|
Description: | modified (diff) |
Keywords: | grib added; grb files removed |
Status: | new → assigned |
Hi, can you provide the file in question?
I suspect the fix is to declare "chData" as "unsigned char" but it would be easier to confirm with a file demonstrating the issue.