summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meta/recipes-qt/qt4/qt4-4.8.5.inc1
-rw-r--r--meta/recipes-qt/qt4/qt4-4.8.5/0028-Fix-a-division-by-zero-when-processing-malformed-BMP.patch44
2 files changed, 45 insertions, 0 deletions
diff --git a/meta/recipes-qt/qt4/qt4-4.8.5.inc b/meta/recipes-qt/qt4/qt4-4.8.5.inc
index 843ad7a03a..f364a78f1f 100644
--- a/meta/recipes-qt/qt4/qt4-4.8.5.inc
+++ b/meta/recipes-qt/qt4/qt4-4.8.5.inc
@@ -26,6 +26,7 @@ SRC_URI = "http://download.qt-project.org/archive/qt/4.8/${PV}/qt-everywhere-ope
26 file://0024-Ensure-lastPixel.y-is-also-initalized-to-1-when-nece.patch \ 26 file://0024-Ensure-lastPixel.y-is-also-initalized-to-1-when-nece.patch \
27 file://0025-Fix-misaligned-selection-region-with-text-when-cente.patch \ 27 file://0025-Fix-misaligned-selection-region-with-text-when-cente.patch \
28 file://0027-tools.pro-disable-qmeegographicssystemhelper.patch \ 28 file://0027-tools.pro-disable-qmeegographicssystemhelper.patch \
29 file://0028-Fix-a-division-by-zero-when-processing-malformed-BMP.patch \
29 file://g++.conf \ 30 file://g++.conf \
30 file://linux.conf \ 31 file://linux.conf \
31 " 32 "
diff --git a/meta/recipes-qt/qt4/qt4-4.8.5/0028-Fix-a-division-by-zero-when-processing-malformed-BMP.patch b/meta/recipes-qt/qt4/qt4-4.8.5/0028-Fix-a-division-by-zero-when-processing-malformed-BMP.patch
new file mode 100644
index 0000000000..8ff4ad5062
--- /dev/null
+++ b/meta/recipes-qt/qt4/qt4-4.8.5/0028-Fix-a-division-by-zero-when-processing-malformed-BMP.patch
@@ -0,0 +1,44 @@
1From e50aa2252cdd5cb53eef7d8c4503c7edff634f68 Mon Sep 17 00:00:00 2001
2From: "Richard J. Moore" <rich@kde.org>
3Date: Tue, 24 Feb 2015 19:02:35 +0000
4Subject: [PATCH] Fix a division by zero when processing malformed BMP files.
5
6This fixes a division by 0 when processing a maliciously crafted BMP
7file. No impact beyond DoS.
8
9Backport of 661f6bfd032dacc62841037732816a583640e187
10
11Upstream-Status: Backport
12
13Task-number: QTBUG-44547
14Change-Id: I43f06e752b11cb50669101460902a82b885ae618
15Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
16Signed-off-by: Jonathan Liu <net147@gmail.com>
17---
18 src/gui/image/qbmphandler.cpp | 6 ++++++
19 1 file changed, 6 insertions(+)
20
21diff --git a/src/gui/image/qbmphandler.cpp b/src/gui/image/qbmphandler.cpp
22index b22e842..30fa9e0 100644
23--- a/src/gui/image/qbmphandler.cpp
24+++ b/src/gui/image/qbmphandler.cpp
25@@ -319,10 +319,16 @@ static bool read_dib_body(QDataStream &s, const BMP_INFOHDR &bi, int offset, int
26 }
27 } else if (comp == BMP_BITFIELDS && (nbits == 16 || nbits == 32)) {
28 red_shift = calc_shift(red_mask);
29+ if (((red_mask >> red_shift) + 1) == 0)
30+ return false;
31 red_scale = 256 / ((red_mask >> red_shift) + 1);
32 green_shift = calc_shift(green_mask);
33+ if (((green_mask >> green_shift) + 1) == 0)
34+ return false;
35 green_scale = 256 / ((green_mask >> green_shift) + 1);
36 blue_shift = calc_shift(blue_mask);
37+ if (((blue_mask >> blue_shift) + 1) == 0)
38+ return false;
39 blue_scale = 256 / ((blue_mask >> blue_shift) + 1);
40 } else if (comp == BMP_RGB && (nbits == 24 || nbits == 32)) {
41 blue_mask = 0x000000ff;
42--
432.3.1
44