From 9e5650f5cfc5e8f284004c830fd5fbf3ed129388 Mon Sep 17 00:00:00 2001 From: Even Rouault Date: Fri, 8 Jan 2016 15:15:53 +0000 Subject: [PATCH] ISO8211: reject invalid record to avoid later assertion git-svn-id: https://svn.osgeo.org/gdal/trunk@32852 f0d54148-0727-0410-94bb-9a71ac55c965 --- gdal/frmts/iso8211/ddfrecord.cpp | 6 ++++++ 1 file changed, 6 insertions(+) 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. */ /* -------------------------------------------------------------------- */