Blame SOURCES/qt5-qtbase-CVE-2018-19870.patch

b5e7a8
diff --git a/src/plugins/imageformats/gif/qgifhandler.cpp b/src/plugins/imageformats/gif/qgifhandler.cpp
b5e7a8
index e0f7f44..ebe5964 100644
b5e7a8
--- a/src/plugins/imageformats/gif/qgifhandler.cpp
b5e7a8
+++ b/src/plugins/imageformats/gif/qgifhandler.cpp
b5e7a8
@@ -354,7 +354,8 @@ int QGIFFormat::decode(QImage *image, const uchar *buffer, int length,
b5e7a8
                     (*image) = QImage(swidth, sheight, format);
b5e7a8
                     bpl = image->bytesPerLine();
b5e7a8
                     bits = image->bits();
b5e7a8
-                    memset(bits, 0, image->sizeInBytes());
b5e7a8
+                    if (bits)
b5e7a8
+                        memset(bits, 0, image->sizeInBytes());
b5e7a8
                 }
b5e7a8
 
b5e7a8
                 // Check if the previous attempt to create the image failed. If it
b5e7a8
@@ -415,6 +416,10 @@ int QGIFFormat::decode(QImage *image, const uchar *buffer, int length,
b5e7a8
                         backingstore = QImage(qMax(backingstore.width(), w),
b5e7a8
                                               qMax(backingstore.height(), h),
b5e7a8
                                               QImage::Format_RGB32);
b5e7a8
+                        if (backingstore.isNull()) {
b5e7a8
+                            state = Error;
b5e7a8
+                            return -1;
b5e7a8
+                        }
b5e7a8
                         memset(backingstore.bits(), 0, backingstore.sizeInBytes());
b5e7a8
                     }
b5e7a8
                     const int dest_bpl = backingstore.bytesPerLine();