diff options
| -rw-r--r-- | recipes-qt/qt5/qtbase/0014-Fix-a-division-by-zero-when-processing-malformed-BMP.patch | 47 | ||||
| -rw-r--r-- | recipes-qt/qt5/qtbase_5.4.1.bb | 1 |
2 files changed, 48 insertions, 0 deletions
diff --git a/recipes-qt/qt5/qtbase/0014-Fix-a-division-by-zero-when-processing-malformed-BMP.patch b/recipes-qt/qt5/qtbase/0014-Fix-a-division-by-zero-when-processing-malformed-BMP.patch new file mode 100644 index 00000000..42159ef4 --- /dev/null +++ b/recipes-qt/qt5/qtbase/0014-Fix-a-division-by-zero-when-processing-malformed-BMP.patch | |||
| @@ -0,0 +1,47 @@ | |||
| 1 | From a343de8e9b85b98f18446d045afbf6f1d3f6c5b4 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: "Richard J. Moore" <rich@kde.org> | ||
| 3 | Date: Sat, 21 Feb 2015 17:43:21 +0000 | ||
| 4 | Subject: [PATCH 14/14] Fix a division by zero when processing malformed BMP | ||
| 5 | files. | ||
| 6 | |||
| 7 | This fixes a division by 0 when processing a maliciously crafted BMP | ||
| 8 | file. No impact beyond DoS. | ||
| 9 | |||
| 10 | Upstream-Status: Backport from 5.4 branch | ||
| 11 | |||
| 12 | Task-number: QTBUG-44547 | ||
| 13 | Change-Id: Ifcded2c0aa712e90d23e6b3969af0ec3add53973 | ||
| 14 | Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> | ||
| 15 | Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com> | ||
| 16 | --- | ||
| 17 | src/gui/image/qbmphandler.cpp | 8 ++++++++ | ||
| 18 | 1 file changed, 8 insertions(+) | ||
| 19 | |||
| 20 | diff --git a/src/gui/image/qbmphandler.cpp b/src/gui/image/qbmphandler.cpp | ||
| 21 | index 21c1a2f..df66499 100644 | ||
| 22 | --- a/src/gui/image/qbmphandler.cpp | ||
| 23 | +++ b/src/gui/image/qbmphandler.cpp | ||
| 24 | @@ -314,12 +314,20 @@ static bool read_dib_body(QDataStream &s, const BMP_INFOHDR &bi, int offset, int | ||
| 25 | } | ||
| 26 | } else if (comp == BMP_BITFIELDS && (nbits == 16 || nbits == 32)) { | ||
| 27 | red_shift = calc_shift(red_mask); | ||
| 28 | + if (((red_mask >> red_shift) + 1) == 0) | ||
| 29 | + return false; | ||
| 30 | red_scale = 256 / ((red_mask >> red_shift) + 1); | ||
| 31 | green_shift = calc_shift(green_mask); | ||
| 32 | + if (((green_mask >> green_shift) + 1) == 0) | ||
| 33 | + return false; | ||
| 34 | green_scale = 256 / ((green_mask >> green_shift) + 1); | ||
| 35 | blue_shift = calc_shift(blue_mask); | ||
| 36 | + if (((blue_mask >> blue_shift) + 1) == 0) | ||
| 37 | + return false; | ||
| 38 | blue_scale = 256 / ((blue_mask >> blue_shift) + 1); | ||
| 39 | alpha_shift = calc_shift(alpha_mask); | ||
| 40 | + if (((alpha_mask >> alpha_shift) + 1) == 0) | ||
| 41 | + return false; | ||
| 42 | alpha_scale = 256 / ((alpha_mask >> alpha_shift) + 1); | ||
| 43 | } else if (comp == BMP_RGB && (nbits == 24 || nbits == 32)) { | ||
| 44 | blue_mask = 0x000000ff; | ||
| 45 | -- | ||
| 46 | 2.3.1 | ||
| 47 | |||
diff --git a/recipes-qt/qt5/qtbase_5.4.1.bb b/recipes-qt/qt5/qtbase_5.4.1.bb index fed9df46..0ff611f1 100644 --- a/recipes-qt/qt5/qtbase_5.4.1.bb +++ b/recipes-qt/qt5/qtbase_5.4.1.bb | |||
| @@ -4,6 +4,7 @@ require ${PN}.inc | |||
| 4 | # This patch is in 5.4 branch but didn't make it into 5.4.1 release | 4 | # This patch is in 5.4 branch but didn't make it into 5.4.1 release |
| 5 | SRC_URI += "\ | 5 | SRC_URI += "\ |
| 6 | file://0013-Fix-build-of-egl-integration.patch \ | 6 | file://0013-Fix-build-of-egl-integration.patch \ |
| 7 | file://0014-Fix-a-division-by-zero-when-processing-malformed-BMP.patch \ | ||
| 7 | " | 8 | " |
| 8 | 9 | ||
| 9 | SRC_URI[md5sum] = "9507825e558c980fed602de1f16ec7ae" | 10 | SRC_URI[md5sum] = "9507825e558c980fed602de1f16ec7ae" |
