From 703136096f4d9f0f5360a1b8937413442568f994 Mon Sep 17 00:00:00 2001 From: Peter Hillman Date: Fri, 12 Jul 2019 18:31:01 +1200 Subject: [PATCH] address #271: catch scanlines with negative sizes --- OpenEXR/IlmImf/ImfScanLineInputFile.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/OpenEXR/IlmImf/ImfScanLineInputFile.cpp b/OpenEXR/IlmImf/ImfScanLineInputFile.cpp index a6620c7fc7..4bd650a064 100644 --- a/OpenEXR/IlmImf/ImfScanLineInputFile.cpp +++ b/OpenEXR/IlmImf/ImfScanLineInputFile.cpp @@ -429,8 +429,8 @@ readPixelData (InputStreamMutex *streamData, if (yInFile != minY) throw IEX_NAMESPACE::InputExc ("Unexpected data block y coordinate."); - if (dataSize > (int) ifd->lineBufferSize) - throw IEX_NAMESPACE::InputExc ("Unexpected data block length."); + if (dataSize < 0 || dataSize > static_cast(ifd->lineBufferSize) ) + throw IEX_NAMESPACE::InputExc ("Unexpected data block length."); // // Read the pixel data.