diff --git a/src/imageformats/ras.cpp b/src/imageformats/ras.cpp index bdba79e..a09ac77 100644 --- a/src/imageformats/ras.cpp +++ b/src/imageformats/ras.cpp @@ -251,6 +251,10 @@ bool RASHandler::read(QImage *outImage) // Read image header. RasHeader ras; s >> ras; + + if (ras.ColorMapLength > std::numeric_limits::max()) + return false; + // TODO: add support for old versions of RAS where Length may be zero in header s.device()->seek(RasHeader::SIZE + ras.Length + ras.ColorMapLength);