Gentoo Archives: gentoo-commits

From: Thomas Deutschmann <whissi@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: app-arch/bzip2/files/, app-arch/bzip2/
Date: Fri, 26 Apr 2019 08:37:05
Message-Id: 1556267695.1948811390283ff8e5f122bd9ec68f2e7b907450.whissi@gentoo
1 commit: 1948811390283ff8e5f122bd9ec68f2e7b907450
2 Author: Amin Hassani <ahassani <AT> chromium <DOT> org>
3 AuthorDate: Mon Mar 25 18:25:34 2019 +0000
4 Commit: Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
5 CommitDate: Fri Apr 26 08:34:55 2019 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=19488113
7
8 app-arch/bzip2: check for nselector's upperbound
9
10 In bzip2 decompressor, the upper bound of nselectors have not been
11 checked and hence a bad payload can cause a segfault. This patch adds
12 that required upperbound check.
13
14 Signed-off-by: Amin Hassani <ahassani <AT> chromium.org>
15 Closes: https://github.com/gentoo/gentoo/pull/11503
16 Signed-off-by: Thomas Deutschmann <whissi <AT> gentoo.org>
17
18 ...ip2-1.0.6-r10.ebuild => bzip2-1.0.6-r11.ebuild} | 1 +
19 .../bzip2-1.0.6-nselectors-upper-bound-check.patch | 30 ++++++++++++++++++++++
20 2 files changed, 31 insertions(+)
21
22 diff --git a/app-arch/bzip2/bzip2-1.0.6-r10.ebuild b/app-arch/bzip2/bzip2-1.0.6-r11.ebuild
23 similarity index 98%
24 rename from app-arch/bzip2/bzip2-1.0.6-r10.ebuild
25 rename to app-arch/bzip2/bzip2-1.0.6-r11.ebuild
26 index 5fb91d277fa..646f6a08d89 100644
27 --- a/app-arch/bzip2/bzip2-1.0.6-r10.ebuild
28 +++ b/app-arch/bzip2/bzip2-1.0.6-r11.ebuild
29 @@ -28,6 +28,7 @@ PATCHES=(
30 "${FILESDIR}"/${PN}-1.0.6-out-of-tree-build.patch
31 "${FILESDIR}"/${PN}-1.0.6-CVE-2016-3189.patch #620466
32 "${FILESDIR}"/${PN}-1.0.6-ubsan-error.patch
33 + "${FILESDIR}"/${PN}-1.0.6-nselectors-upper-bound-check.patch
34 )
35
36 DOCS=( CHANGES README{,.COMPILATION.PROBLEMS,.XML.STUFF} manual.pdf )
37
38 diff --git a/app-arch/bzip2/files/bzip2-1.0.6-nselectors-upper-bound-check.patch b/app-arch/bzip2/files/bzip2-1.0.6-nselectors-upper-bound-check.patch
39 new file mode 100644
40 index 00000000000..a7731f7de8f
41 --- /dev/null
42 +++ b/app-arch/bzip2/files/bzip2-1.0.6-nselectors-upper-bound-check.patch
43 @@ -0,0 +1,30 @@
44 +From 13ca8fee0c897121ae79ae644a212418398dfea7 Mon Sep 17 00:00:00 2001
45 +From: Amin Hassani <ahassani@××××××××.org>
46 +Date: Fri, 8 Mar 2019 09:58:20 -0800
47 +Subject: [PATCH] Check for upper bounds of nselectors.
48 +
49 +Currently there is no check for the upper bounds of the
50 +nselectors. Hence, a corrupt input can cause a segfault.
51 +
52 +This issue was discovered by one of our fuzzers. The actual error was:
53 +
54 +../bzip2-1.0.6/decompress.c:299:10: runtime error: index 18002 out of bounds for type 'UChar [18002]'
55 +---
56 + decompress.c | 1 +
57 + 1 file changed, 1 insertion(+)
58 +
59 +diff --git a/decompress.c b/decompress.c
60 +index 311f566..391552d 100644
61 +--- a/decompress.c
62 ++++ b/decompress.c
63 +@@ -288,6 +288,7 @@ Int32 BZ2_decompress ( DState* s )
64 + if (nGroups < 2 || nGroups > 6) RETURN(BZ_DATA_ERROR);
65 + GET_BITS(BZ_X_SELECTOR_2, nSelectors, 15);
66 + if (nSelectors < 1) RETURN(BZ_DATA_ERROR);
67 ++ if (nSelectors > BZ_MAX_SELECTORS) RETURN(BZ_DATA_ERROR);
68 + for (i = 0; i < nSelectors; i++) {
69 + j = 0;
70 + while (True) {
71 +--
72 +2.21.0.360.g471c308f928-goog
73 +