#7204 closed defect (fixed)
NTF Generic Attribute Reading: Offset at end of record treated as error instead of simply as end of data
Reported by: | molnar | Owned by: | warmerdam |
---|---|---|---|
Priority: | normal | Milestone: | 2.1.5 |
Component: | OGR_SF | Version: | unspecified |
Severity: | normal | Keywords: | |
Cc: |
Description
This commit guards against overrunning the attribute record buffer, which is good: https://github.com/OSGeo/gdal/commit/9c3a4a49a3d95cf9d122dee4449308e7e57b98e9
However, I think this commit may be a bit overzealous in safety: https://github.com/OSGeo/gdal/commit/2b3f5f329d671e8d0a94a73ad6920f391cec1228
See line 953
iOffset = nEnd; if( iOffset >= poRecord->GetLength() ) { bError = true; break; }
I believe an offset that is equal to the record length should simply break the loop, and should not be an error. Greater offsets may still be an error.
I might suggest:
iOffset = nEnd; const int nRecordLength = poRecord->GetLength(); if( iOffset >= nRecordLength ) { bError = (iOffset > nRecordLength); break; }
or something similar. Attaching a repro dataset
Attachments (1)
Change History (5)
by , 6 years ago
Attachment: | ntf-repro.tar.gz added |
---|
comment:4 by , 6 years ago
Milestone: | → 2.1.5 |
---|
Note:
See TracTickets
for help on using tickets.
Repro dataset