Check for TQImage allocation failure in qasyncimageio.

Since image files easily can be (or corrupt files claim to be) huge,
it is worth checking for out of memory situations.

Based on Qt5 patch for CVE-2018-19870.

Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
(cherry picked from commit 83036c3af1)
r14.0.x
Slávek Banko 5 years ago
parent 07eabff779
commit a195af105a
No known key found for this signature in database
GPG Key ID: 608F5293A04BE668

@ -964,9 +964,12 @@ int TQGIFFormat::decode(TQImage& img, TQImageConsumer* consumer,
if (backingstore.width() < w
|| backingstore.height() < h) {
// We just use the backing store as a byte array
backingstore.create( TQMAX(backingstore.width(), w),
TQMAX(backingstore.height(), h),
32);
if(!backingstore.create( TQMAX(backingstore.width(), w),
TQMAX(backingstore.height(), h),
32)) {
state = Error;
return -1;
}
memset( img.bits(), 0, img.numBytes() );
}
for (int ln=0; ln<h; ln++) {

Loading…
Cancel
Save