From 1f36381c019537a9cd8cd66257cde17249972ea8 Mon Sep 17 00:00:00 2001 From: Raphael Kubo da Costa Date: Fri, 6 Mar 2015 22:05:30 +0000 Subject: MFH: r380452 Add patch for CVE-2015-0295, DoS vulnerability in the BMP image handler. Security: c9c3374d-c2c1-11e4-b236-5453ed2e2b49 Approved by: ports-secteam (delphij) --- x11-toolkits/qt4-gui/Makefile | 2 +- x11-toolkits/qt4-gui/files/patch-CVE-2015-0295 | 34 +++++++++++++++++++++++ x11-toolkits/qt5-gui/Makefile | 2 +- x11-toolkits/qt5-gui/files/patch-CVE-2015-0295 | 37 ++++++++++++++++++++++++++ 4 files changed, 73 insertions(+), 2 deletions(-) create mode 100644 x11-toolkits/qt4-gui/files/patch-CVE-2015-0295 create mode 100644 x11-toolkits/qt5-gui/files/patch-CVE-2015-0295 diff --git a/x11-toolkits/qt4-gui/Makefile b/x11-toolkits/qt4-gui/Makefile index a85104eb6ffa..7731553304e3 100644 --- a/x11-toolkits/qt4-gui/Makefile +++ b/x11-toolkits/qt4-gui/Makefile @@ -3,7 +3,7 @@ PORTNAME= gui DISTVERSION= ${QT4_VERSION} -PORTREVISION= 3 +PORTREVISION= 4 CATEGORIES= x11-toolkits PKGNAMEPREFIX= qt4- diff --git a/x11-toolkits/qt4-gui/files/patch-CVE-2015-0295 b/x11-toolkits/qt4-gui/files/patch-CVE-2015-0295 new file mode 100644 index 000000000000..46249856032c --- /dev/null +++ b/x11-toolkits/qt4-gui/files/patch-CVE-2015-0295 @@ -0,0 +1,34 @@ +commit e50aa2252cdd5cb53eef7d8c4503c7edff634f68 +Author: Richard J. Moore +Date: Tue Feb 24 19:02:35 2015 +0000 + + Fix a division by zero when processing malformed BMP files. + + This fixes a division by 0 when processing a maliciously crafted BMP + file. No impact beyond DoS. + + Backport of 661f6bfd032dacc62841037732816a583640e187 + + Task-number: QTBUG-44547 + Change-Id: I43f06e752b11cb50669101460902a82b885ae618 + Reviewed-by: Thiago Macieira + +--- src/gui/image/qbmphandler.cpp ++++ src/gui/image/qbmphandler.cpp +@@ -319,10 +319,16 @@ static bool read_dib_body(QDataStream &s, const BMP_INFOHDR &bi, int offset, int + } + } else if (comp == BMP_BITFIELDS && (nbits == 16 || nbits == 32)) { + red_shift = calc_shift(red_mask); ++ if (((red_mask >> red_shift) + 1) == 0) ++ return false; + red_scale = 256 / ((red_mask >> red_shift) + 1); + green_shift = calc_shift(green_mask); ++ if (((green_mask >> green_shift) + 1) == 0) ++ return false; + green_scale = 256 / ((green_mask >> green_shift) + 1); + blue_shift = calc_shift(blue_mask); ++ if (((blue_mask >> blue_shift) + 1) == 0) ++ return false; + blue_scale = 256 / ((blue_mask >> blue_shift) + 1); + } else if (comp == BMP_RGB && (nbits == 24 || nbits == 32)) { + blue_mask = 0x000000ff; diff --git a/x11-toolkits/qt5-gui/Makefile b/x11-toolkits/qt5-gui/Makefile index 413351ebe2a2..d2376d941f54 100644 --- a/x11-toolkits/qt5-gui/Makefile +++ b/x11-toolkits/qt5-gui/Makefile @@ -2,7 +2,7 @@ PORTNAME= gui DISTVERSION= ${QT5_VERSION} -PORTREVISION= 1 +PORTREVISION= 2 CATEGORIES= x11-toolkits graphics PKGNAMEPREFIX= qt5- diff --git a/x11-toolkits/qt5-gui/files/patch-CVE-2015-0295 b/x11-toolkits/qt5-gui/files/patch-CVE-2015-0295 new file mode 100644 index 000000000000..5a32eb93b026 --- /dev/null +++ b/x11-toolkits/qt5-gui/files/patch-CVE-2015-0295 @@ -0,0 +1,37 @@ +commit 661f6bfd032dacc62841037732816a583640e187 +Author: Richard J. Moore +Date: Sat Feb 21 17:43:21 2015 +0000 + + Fix a division by zero when processing malformed BMP files. + + This fixes a division by 0 when processing a maliciously crafted BMP + file. No impact beyond DoS. + + Task-number: QTBUG-44547 + Change-Id: Ifcded2c0aa712e90d23e6b3969af0ec3add53973 + Reviewed-by: Thiago Macieira + Reviewed-by: Oswald Buddenhagen + +--- src/gui/image/qbmphandler.cpp ++++ src/gui/image/qbmphandler.cpp +@@ -314,12 +314,20 @@ static bool read_dib_body(QDataStream &s, const BMP_INFOHDR &bi, int offset, int + } + } else if (comp == BMP_BITFIELDS && (nbits == 16 || nbits == 32)) { + red_shift = calc_shift(red_mask); ++ if (((red_mask >> red_shift) + 1) == 0) ++ return false; + red_scale = 256 / ((red_mask >> red_shift) + 1); + green_shift = calc_shift(green_mask); ++ if (((green_mask >> green_shift) + 1) == 0) ++ return false; + green_scale = 256 / ((green_mask >> green_shift) + 1); + blue_shift = calc_shift(blue_mask); ++ if (((blue_mask >> blue_shift) + 1) == 0) ++ return false; + blue_scale = 256 / ((blue_mask >> blue_shift) + 1); + alpha_shift = calc_shift(alpha_mask); ++ if (((alpha_mask >> alpha_shift) + 1) == 0) ++ return false; + alpha_scale = 256 / ((alpha_mask >> alpha_shift) + 1); + } else if (comp == BMP_RGB && (nbits == 24 || nbits == 32)) { + blue_mask = 0x000000ff; -- cgit v1.2.3