From df987cabc20c90803692022fd232def837cb88cc Mon Sep 17 00:00:00 2001 From: Peter Hillman Date: Mon, 20 Jan 2020 10:52:17 +1300 Subject: [PATCH] validate tiles have valid headers when raw reading tiles Signed-off-by: Peter Hillman --- OpenEXR/IlmImf/ImfTiledInputFile.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/OpenEXR/IlmImf/ImfTiledInputFile.cpp b/OpenEXR/IlmImf/ImfTiledInputFile.cpp index e68f713bd1..20ff0e563d 100644 --- a/OpenEXR/IlmImf/ImfTiledInputFile.cpp +++ b/OpenEXR/IlmImf/ImfTiledInputFile.cpp @@ -1316,6 +1316,11 @@ TiledInputFile::rawTileData (int &dx, int &dy, readNextTileData (_data->_streamData, _data, dx, dy, lx, ly, tileBuffer->buffer, pixelDataSize); + + if ( !isValidLevel(lx,ly) || !isValidTile (dx, dy, lx, ly) ) + throw IEX_NAMESPACE::ArgExc ("File contains an invalid tile"); + + if(isMultiPart(version())) { if (old_dx!=dx || old_dy !=dy || old_lx!=lx || old_ly!=ly)