From 039d7d8fbed85c01fe78e9f6a1c0d42fe442f116 Mon Sep 17 00:00:00 2001 From: Albert Astals Cid Date: Wed, 6 Feb 2019 22:06:58 +0100 Subject: [PATCH] ras: don't assert because we try to allicate a huge vector oss-fuzz/12915 --- src/imageformats/ras.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/imageformats/ras.cpp b/src/imageformats/ras.cpp index 3634ce4..9271f5e 100644 --- a/src/imageformats/ras.cpp +++ b/src/imageformats/ras.cpp @@ -121,6 +121,10 @@ static bool LoadRAS(QDataStream &s, const RasHeader &ras, QImage &img) qWarning() << "LoadRAS() mistmatch between height and width" << ras.Width << ras.Height << ras.Length << ras.Depth; return false; } + if (ras.Length > std::numeric_limits::max()) { + qWarning() << "LoadRAS() unsupported image length in file header" << ras.Length; + return false; + } // each line must be a factor of 16 bits, so they may contain padding // this will be 1 if padding required, 0 otherwise