From 645daec1ef2eee94524e08978ad1db9a6901f78c Mon Sep 17 00:00:00 2001 From: Albert Astals Cid Date: Wed, 17 Apr 2019 20:03:52 +0200 Subject: [PATCH] ras: Don't overread input on malformed files --- src/imageformats/ras.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/imageformats/ras.cpp b/src/imageformats/ras.cpp index 15f8017..2d0e5a4 100644 --- a/src/imageformats/ras.cpp +++ b/src/imageformats/ras.cpp @@ -143,7 +143,7 @@ static bool LoadRAS(QDataStream &s, const RasHeader &ras, QImage &img) QVector input(ras.Length); int i = 0; - while (! s.atEnd()) { + while (! s.atEnd() && i < input.size()) { s >> input[i]; // I guess we need to find out if we're at the end of a line if (paddingrequired && i != 0 && !(i % (ras.Width * bpp))) {