From 74c8aa76089ce0b16ddd4d560530cf6df85d397e Mon Sep 17 00:00:00 2001 From: Eirik Aavitsland Date: Fri, 4 Jan 2019 10:32:28 +0100 Subject: bmp image handler: Reject invalid 0-dimension files early Avoid spending time on decoding attempt of invalid bmp files specifying height or width as 0. Change-Id: Ia6666088515eee54777f7154868fb7d07c6b4438 Done-with: Albert Astals Cid Reviewed-by: Lars Knoll Reviewed-by: Albert Astals Cid --- src/gui/image/qbmphandler.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gui/image/qbmphandler.cpp b/src/gui/image/qbmphandler.cpp index 5dff4ab0ac..7257853c3e 100644 --- a/src/gui/image/qbmphandler.cpp +++ b/src/gui/image/qbmphandler.cpp @@ -188,7 +188,7 @@ static bool read_dib_infoheader(QDataStream &s, BMP_INFOHDR &bi) if (!(comp == BMP_RGB || (nbits == 4 && comp == BMP_RLE4) || (nbits == 8 && comp == BMP_RLE8) || ((nbits == 16 || nbits == 32) && comp == BMP_BITFIELDS))) return false; // weird compression type - if (bi.biWidth < 0 || quint64(bi.biWidth) * qAbs(bi.biHeight) > 16384 * 16384) + if (bi.biWidth <= 0 || !bi.biHeight || quint64(bi.biWidth) * qAbs(bi.biHeight) > 16384 * 16384) return false; return true; -- cgit v1.2.3