aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBart Ribbers <bribbers@disroot.org>2020-08-18 12:49:47 +0200
committerBart Ribbers <bribbers@disroot.org>2020-08-18 12:51:01 +0200
commit92cbb6be98e8c1b9eed24ac98f9eea0a9fec6543 (patch)
tree3041e910696bbd05a057954d30658d9c2bbfadae
parent188bfebd7fea03daaef5d1fd4495af597b0a3f02 (diff)
downloadaports-92cbb6be98e8c1b9eed24ac98f9eea0a9fec6543.tar.gz
aports-92cbb6be98e8c1b9eed24ac98f9eea0a9fec6543.tar.bz2
aports-92cbb6be98e8c1b9eed24ac98f9eea0a9fec6543.tar.xz
community/qt5-qtbase: fix CVE-2020-17507
Part of a fix for #11871
-rw-r--r--community/qt5-qtbase/APKBUILD11
-rw-r--r--community/qt5-qtbase/fix-buffer-overflow-in-xbm-parser.patch88
2 files changed, 97 insertions, 2 deletions
diff --git a/community/qt5-qtbase/APKBUILD b/community/qt5-qtbase/APKBUILD
index 33c7c79eb2..ac3d360084 100644
--- a/community/qt5-qtbase/APKBUILD
+++ b/community/qt5-qtbase/APKBUILD
@@ -1,7 +1,7 @@
# Maintainer: Bart Ribbers <bribbers@disroot.org>
pkgname=qt5-qtbase
pkgver=5.14.2
-pkgrel=0
+pkgrel=1
pkgdesc="Qt5 - QtBase components"
url="https://qt.io/developers/"
arch="all"
@@ -54,6 +54,7 @@ esac
source="https://download.qt.io/$_rel/qt/${pkgver%.*}/$pkgver/submodules/qtbase-everywhere-src-$pkgver.tar.xz
qt-musl-iconv-no-bom.patch
+ fix-buffer-overflow-in-xbm-parser.patch
"
_qt5_prefix=/usr/lib/qt5
@@ -64,6 +65,11 @@ case "$CTARGET_ARCH" in
*) _opengl="-opengl";;
esac
+# secfixes:
+# 5.14.2-r1:
+# - CVE-2020-17507
+
+
prepare() {
default_prepare
@@ -209,4 +215,5 @@ x11() {
}
sha512sums="8c83e06d58b56e9f288e83d6c3dd4ad6cc9f1eb1a32c7b44fb912fda34ed7255766fd9fa60cd740ee001df7d6172f25df05f1f95e986c3e793fbcd9bf4f18de9 qtbase-everywhere-src-5.14.2.tar.xz
-7d68421a14f0259535c977d8a521c98918193c107b76ac664571b12f5b0d7588a0d0e1297af412a26753a393b21f3f44c3274fa8ab5bc87f03705a3a03acb444 qt-musl-iconv-no-bom.patch"
+7d68421a14f0259535c977d8a521c98918193c107b76ac664571b12f5b0d7588a0d0e1297af412a26753a393b21f3f44c3274fa8ab5bc87f03705a3a03acb444 qt-musl-iconv-no-bom.patch
+61f9d1ee6395a9617b940121a4112bbaa76c2300c66cbfc89118b2e704e3d0e8216b86a29dc0adc95ac87461d2299d4e5767ec43bfaf5ae67b39612ede0a7d06 fix-buffer-overflow-in-xbm-parser.patch"
diff --git a/community/qt5-qtbase/fix-buffer-overflow-in-xbm-parser.patch b/community/qt5-qtbase/fix-buffer-overflow-in-xbm-parser.patch
new file mode 100644
index 0000000000..16a0cef127
--- /dev/null
+++ b/community/qt5-qtbase/fix-buffer-overflow-in-xbm-parser.patch
@@ -0,0 +1,88 @@
+From 1616c71921b73b227f56ccb3f2c49a994ec23440 Mon Sep 17 00:00:00 2001
+From: Allan Sandfeld Jensen <allan.jensen@qt.io>
+Date: Thu, 23 Jul 2020 11:48:48 +0200
+Subject: [PATCH] Fix buffer overflow in XBM parser
+
+Avoid parsing over the buffer limit, or interpreting non-hex
+as hex.
+
+This still leaves parsing of lines longer than 300 chars
+unreliable
+
+Change-Id: I1c57a7e530c4380f6f9040b2ec729ccd7dc7a5fb
+Reviewed-by: Robert Loehning <robert.loehning@qt.io>
+Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
+(cherry picked from commit c562c1fc19629fb505acd0f6380604840b634211)
+Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
+---
+
+diff --git a/src/gui/image/qxbmhandler.cpp b/src/gui/image/qxbmhandler.cpp
+index f065616..72ce7f7 100644
+--- a/src/gui/image/qxbmhandler.cpp
++++ b/src/gui/image/qxbmhandler.cpp
+@@ -159,7 +159,9 @@
+ w = (w+7)/8; // byte width
+
+ while (y < h) { // for all encoded bytes...
+- if (p) { // p = "0x.."
++ if (p && p < (buf + readBytes - 3)) { // p = "0x.."
++ if (!isxdigit(p[2]) || !isxdigit(p[3]))
++ return false;
+ *b++ = hex2byte(p+2);
+ p += 2;
+ if (++x == w && ++y < h) {
+diff --git a/tests/auto/gui/image/qimagereader/tst_qimagereader.cpp b/tests/auto/gui/image/qimagereader/tst_qimagereader.cpp
+index cf8a0d1..984a7c7 100644
+--- a/tests/auto/gui/image/qimagereader/tst_qimagereader.cpp
++++ b/tests/auto/gui/image/qimagereader/tst_qimagereader.cpp
+@@ -175,6 +175,8 @@
+
+ void xpmBufferOverflow();
+
++ void xbmBufferHandling();
++
+ private:
+ QString prefix;
+ QTemporaryDir m_temporaryDir;
+@@ -2055,5 +2057,41 @@
+ QImageReader(":/images/oss-fuzz-23988.xpm").read();
+ }
+
++void tst_QImageReader::xbmBufferHandling()
++{
++ uint8_t original_buffer[256];
++ for (int i = 0; i < 256; ++i)
++ original_buffer[i] = i;
++
++ QImage image(original_buffer, 256, 8, QImage::Format_MonoLSB);
++ image.setColorTable({0xff000000, 0xffffffff});
++
++ QByteArray buffer;
++ {
++ QBuffer buf(&buffer);
++ QImageWriter writer(&buf, "xbm");
++ writer.write(image);
++ }
++
++ QCOMPARE(QImage::fromData(buffer, "xbm"), image);
++
++ auto i = buffer.indexOf(',');
++ buffer.insert(i + 1, " ");
++ QCOMPARE(QImage::fromData(buffer, "xbm"), image);
++ buffer.insert(i + 1, " ");
++ QCOMPARE(QImage::fromData(buffer, "xbm"), image);
++ buffer.insert(i + 1, " ");
++#if 0 // Lines longer than 300 chars not supported currently
++ QCOMPARE(QImage::fromData(buffer, "xbm"), image);
++#endif
++
++ i = buffer.lastIndexOf("\n ");
++ buffer.truncate(i + 1);
++ buffer.append(QByteArray(297, ' '));
++ buffer.append("0x");
++ // Only check we get no buffer overflow
++ QImage::fromData(buffer, "xbm");
++}
++
+ QTEST_MAIN(tst_QImageReader)
+ #include "tst_qimagereader.moc"