diff --git a/gdal/frmts/iso8211/ddfrecord.cpp b/gdal/frmts/iso8211/ddfrecord.cpp index 4df5d74d0c78..889d806a366b 100644 --- a/gdal/frmts/iso8211/ddfrecord.cpp +++ b/gdal/frmts/iso8211/ddfrecord.cpp @@ -358,6 +358,12 @@ int DDFRecord::ReadHeader() "Didn't find field terminator, read one more byte." ); } + if( nFieldOffset >= nDataSize ) + { + CPLError(CE_Failure, CPLE_AssertionFailed, "nFieldOffset < nDataSize"); + return FALSE; + } + /* -------------------------------------------------------------------- */ /* Loop over the directory entries, making a pass counting them. */ /* -------------------------------------------------------------------- */