summaryrefslogtreecommitdiffstats
path: root/src/kernel/qimage.cpp
diff options
context:
space:
mode:
authorSlávek Banko <slavek.banko@axis.cz>2019-01-28 11:42:06 +0100
committerSlávek Banko <slavek.banko@axis.cz>2019-03-03 15:36:55 +0100
commit5a61151fe90ed84dce18998fe6c7d69ec6e49c74 (patch)
treec0d5bd7622a29c49e7992bf78b2fcd1fb6397fa7 /src/kernel/qimage.cpp
parent83036c3af1ff5439b9106a31738650c54920e475 (diff)
downloadtqt3-5a61151fe90ed84dce18998fe6c7d69ec6e49c74.tar.gz
tqt3-5a61151fe90ed84dce18998fe6c7d69ec6e49c74.zip
bmp image: check for out of range image size.
Make the decoder fail early to avoid spending time and memory on attempting to decode a corrupt image file. Based on Qt5 patch for CVE-2018-19873. Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
Diffstat (limited to 'src/kernel/qimage.cpp')
-rw-r--r--src/kernel/qimage.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/kernel/qimage.cpp b/src/kernel/qimage.cpp
index 2f7038bbf..769eba201 100644
--- a/src/kernel/qimage.cpp
+++ b/src/kernel/qimage.cpp
@@ -4667,6 +4667,8 @@ bool read_dib( TQDataStream& s, int offset, int startpos, TQImage& image )
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 ((w < 0) || ((w * abs(h)) > (16384 * 16384)))
+ return FALSE;
int ncols;
int depth;