|
Rex Dieter |
b83b6ab |
From f1b76c126c476c155af8c404b97c42cd1a709333 Mon Sep 17 00:00:00 2001
|
|
Rex Dieter |
b83b6ab |
From: Lars Knoll <lars.knoll@digia.com>
|
|
Rex Dieter |
b83b6ab |
Date: Thu, 24 Apr 2014 15:33:27 +0200
|
|
Rex Dieter |
b83b6ab |
Subject: [PATCH 23/74] Don't crash on broken GIF images
|
|
Rex Dieter |
b83b6ab |
|
|
Rex Dieter |
b83b6ab |
Broken GIF images could set invalid width and height
|
|
Rex Dieter |
b83b6ab |
values inside the image, leading to Qt creating a null
|
|
Rex Dieter |
b83b6ab |
QImage for it. In that case we need to abort decoding
|
|
Rex Dieter |
b83b6ab |
the image and return an error.
|
|
Rex Dieter |
b83b6ab |
|
|
Rex Dieter |
b83b6ab |
Initial patch by Rich Moore.
|
|
Rex Dieter |
b83b6ab |
|
|
Rex Dieter |
b83b6ab |
Backport of Id82a4036f478bd6e49c402d6598f57e7e5bb5e1e from Qt 5
|
|
Rex Dieter |
b83b6ab |
|
|
Rex Dieter |
b83b6ab |
Task-number: QTBUG-38367
|
|
Rex Dieter |
b83b6ab |
Change-Id: I0680740018aaa8356d267b7af3f01fac3697312a
|
|
Rex Dieter |
b83b6ab |
Security-advisory: CVE-2014-0190
|
|
Rex Dieter |
b83b6ab |
Reviewed-by: Richard J. Moore <rich@kde.org>
|
|
Rex Dieter |
b83b6ab |
---
|
|
Rex Dieter |
b83b6ab |
src/gui/image/qgifhandler.cpp | 7 +++++++
|
|
Rex Dieter |
b83b6ab |
1 file changed, 7 insertions(+)
|
|
Rex Dieter |
b83b6ab |
|
|
Rex Dieter |
b83b6ab |
diff --git a/src/gui/image/qgifhandler.cpp b/src/gui/image/qgifhandler.cpp
|
|
Rex Dieter |
b83b6ab |
index 3324f04..5199dd3 100644
|
|
Rex Dieter |
b83b6ab |
--- a/src/gui/image/qgifhandler.cpp
|
|
Rex Dieter |
b83b6ab |
+++ b/src/gui/image/qgifhandler.cpp
|
|
Rex Dieter |
b83b6ab |
@@ -359,6 +359,13 @@ int QGIFFormat::decode(QImage *image, const uchar *buffer, int length,
|
|
Rex Dieter |
b83b6ab |
memset(bits, 0, image->byteCount());
|
|
Rex Dieter |
b83b6ab |
}
|
|
Rex Dieter |
b83b6ab |
|
|
Rex Dieter |
b83b6ab |
+ // Check if the previous attempt to create the image failed. If it
|
|
Rex Dieter |
b83b6ab |
+ // did then the image is broken and we should give up.
|
|
Rex Dieter |
b83b6ab |
+ if (image->isNull()) {
|
|
Rex Dieter |
b83b6ab |
+ state = Error;
|
|
Rex Dieter |
b83b6ab |
+ return -1;
|
|
Rex Dieter |
b83b6ab |
+ }
|
|
Rex Dieter |
b83b6ab |
+
|
|
Rex Dieter |
b83b6ab |
disposePrevious(image);
|
|
Rex Dieter |
b83b6ab |
disposed = false;
|
|
Rex Dieter |
b83b6ab |
|
|
Rex Dieter |
b83b6ab |
--
|
|
Rex Dieter |
b83b6ab |
1.9.3
|
|
Rex Dieter |
b83b6ab |
|