1 |
commit: 1dad375a54557f44c6cb404433cd7915f9c8a2eb |
2 |
Author: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org> |
3 |
AuthorDate: Thu Aug 3 00:39:44 2017 +0000 |
4 |
Commit: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org> |
5 |
CommitDate: Thu Aug 3 00:39:44 2017 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/kde.git/commit/?id=1dad375a |
7 |
|
8 |
kde-apps/k3b: Fix K3b::Device::from2Byte out-of-bounds issue |
9 |
|
10 |
See also: https://bugs.kde.org/show_bug.cgi?id=382941 |
11 |
|
12 |
Gentoo-bug: 616880 |
13 |
|
14 |
Package-Manager: Portage-2.3.6, Repoman-2.3.1 |
15 |
|
16 |
kde-apps/k3b/files/k3b-17.04.3-out-of-bounds.patch | 75 ++++++++++++++++++++++ |
17 |
kde-apps/k3b/k3b-17.08.49.9999.ebuild | 2 + |
18 |
2 files changed, 77 insertions(+) |
19 |
|
20 |
diff --git a/kde-apps/k3b/files/k3b-17.04.3-out-of-bounds.patch b/kde-apps/k3b/files/k3b-17.04.3-out-of-bounds.patch |
21 |
new file mode 100644 |
22 |
index 0000000000..83034e7481 |
23 |
--- /dev/null |
24 |
+++ b/kde-apps/k3b/files/k3b-17.04.3-out-of-bounds.patch |
25 |
@@ -0,0 +1,75 @@ |
26 |
+From 7f0be6a33b8260f7789c6aeed58be8d1c844229a Mon Sep 17 00:00:00 2001 |
27 |
+From: Leslie Zhai <lesliezhai@××××××××.cn> |
28 |
+Date: Tue, 1 Aug 2017 14:13:05 +0800 |
29 |
+Subject: Fix K3b::Device::from2Byte out-of-bounds issue. |
30 |
+ |
31 |
+A great bug report by Mark! |
32 |
+ |
33 |
+BUG: 382941 |
34 |
+--- |
35 |
+ libk3bdevice/k3bdeviceglobals.cpp | 24 ++++++++++++------------ |
36 |
+ tests/k3bdeviceglobalstest.cpp | 4 +++- |
37 |
+ 2 files changed, 15 insertions(+), 13 deletions(-) |
38 |
+ |
39 |
+diff --git a/libk3bdevice/k3bdeviceglobals.cpp b/libk3bdevice/k3bdeviceglobals.cpp |
40 |
+index 090ed29..c016f59 100644 |
41 |
+--- a/libk3bdevice/k3bdeviceglobals.cpp |
42 |
++++ b/libk3bdevice/k3bdeviceglobals.cpp |
43 |
+@@ -212,27 +212,27 @@ void K3b::Device::debugBitfield( unsigned char* data, long len ) |
44 |
+ } |
45 |
+ |
46 |
+ |
47 |
+-quint16 K3b::Device::from2Byte( const unsigned char* d ) |
48 |
++quint16 K3b::Device::from2Byte(const unsigned char* d) |
49 |
+ { |
50 |
+- if (d == NULL) { |
51 |
+- qWarning() << "Invalid nullptr!"; |
52 |
++ if (d == NULL || strlen((const char *) d) < 2) { |
53 |
++ qWarning() << "Invalid Byte!"; |
54 |
+ return 0; |
55 |
+ } |
56 |
+- return ( (d[0] << 8 & 0xFF00) | |
57 |
+- (d[1] & 0xFF) ); |
58 |
++ return ((d[0] << 8 & 0xFF00) | |
59 |
++ (d[1] & 0xFF)); |
60 |
+ } |
61 |
+ |
62 |
+ |
63 |
+-quint32 K3b::Device::from4Byte( const unsigned char* d ) |
64 |
++quint32 K3b::Device::from4Byte(const unsigned char* d) |
65 |
+ { |
66 |
+- if (d == NULL) { |
67 |
+- qWarning() << "Invalid nullptr!"; |
68 |
++ if (d == NULL || strlen((const char *) d) < 4) { |
69 |
++ qWarning() << "Invalid Byte!"; |
70 |
+ return 0; |
71 |
+ } |
72 |
+- return ( (d[0] << 24 & 0xFF000000) | |
73 |
+- (d[1] << 16 & 0xFF0000) | |
74 |
+- (d[2] << 8 & 0xFF00) | |
75 |
+- (d[3] & 0xFF) ); |
76 |
++ return ((d[0] << 24 & 0xFF000000) | |
77 |
++ (d[1] << 16 & 0xFF0000) | |
78 |
++ (d[2] << 8 & 0xFF00) | |
79 |
++ (d[3] & 0xFF)); |
80 |
+ } |
81 |
+ |
82 |
+ |
83 |
+diff --git a/tests/k3bdeviceglobalstest.cpp b/tests/k3bdeviceglobalstest.cpp |
84 |
+index 307b772..635ee39 100644 |
85 |
+--- a/tests/k3bdeviceglobalstest.cpp |
86 |
++++ b/tests/k3bdeviceglobalstest.cpp |
87 |
+@@ -23,8 +23,10 @@ DeviceGlobalsTest::DeviceGlobalsTest() |
88 |
+ |
89 |
+ void DeviceGlobalsTest::testFrom2Byte() |
90 |
+ { |
91 |
+- const unsigned char* d = NULL; |
92 |
++ unsigned char* d = NULL; |
93 |
+ QCOMPARE(K3b::Device::from2Byte(d), (quint16)0); |
94 |
++ unsigned char buf[1] = { '\0' }; |
95 |
++ QCOMPARE(K3b::Device::from2Byte(buf), (quint16)0); |
96 |
+ } |
97 |
+ |
98 |
+ void DeviceGlobalsTest::testFrom4Byte() |
99 |
+-- |
100 |
+cgit v0.11.2 |
101 |
|
102 |
diff --git a/kde-apps/k3b/k3b-17.08.49.9999.ebuild b/kde-apps/k3b/k3b-17.08.49.9999.ebuild |
103 |
index c5366a7575..70aec75bf0 100644 |
104 |
--- a/kde-apps/k3b/k3b-17.08.49.9999.ebuild |
105 |
+++ b/kde-apps/k3b/k3b-17.08.49.9999.ebuild |
106 |
@@ -77,6 +77,8 @@ REQUIRED_USE=" |
107 |
|
108 |
DOCS+=( ChangeLog {FAQ,PERMISSIONS,README}.txt ) |
109 |
|
110 |
+PATCHES=( "${FILESDIR}/${PN}-17.04.3-out-of-bounds.patch" ) |
111 |
+ |
112 |
src_configure() { |
113 |
local mycmakeargs=( |
114 |
-DK3B_BUILD_API_DOCS=OFF |