Blame SOURCES/qt-check-for-qimage-allocation-failure-in-qgifhandler.patch

80a0e2
diff --git a/src/gui/image/qgifhandler.cpp b/src/gui/image/qgifhandler.cpp
80a0e2
index 2a9217a2..28823f84 100644
80a0e2
--- a/src/gui/image/qgifhandler.cpp
80a0e2
+++ b/src/gui/image/qgifhandler.cpp
80a0e2
@@ -356,7 +356,8 @@ int QGIFFormat::decode(QImage *image, const uchar *buffer, int length,
80a0e2
                     (*image) = QImage(swidth, sheight, format);
80a0e2
                     bpl = image->bytesPerLine();
80a0e2
                     bits = image->bits();
80a0e2
-                    memset(bits, 0, image->byteCount());
80a0e2
+                    if (bits)
80a0e2
+                        memset(bits, 0, image->byteCount());
80a0e2
                 }
80a0e2
 
80a0e2
                 // Check if the previous attempt to create the image failed. If it
80a0e2
@@ -417,6 +418,10 @@ int QGIFFormat::decode(QImage *image, const uchar *buffer, int length,
80a0e2
                         backingstore = QImage(qMax(backingstore.width(), w),
80a0e2
                                               qMax(backingstore.height(), h),
80a0e2
                                               QImage::Format_RGB32);
80a0e2
+                        if (backingstore.isNull()) {
80a0e2
+                            state = Error;
80a0e2
+                            return -1;
80a0e2
+                        }
80a0e2
                         memset(bits, 0, image->byteCount());
80a0e2
                     }
80a0e2
                     const int dest_bpl = backingstore.bytesPerLine();