From 82057c49843e8009c6c26ee1efbee3e9531b3e4a Mon Sep 17 00:00:00 2001 From: IdrisKalp Date: Wed, 11 Dec 2019 01:50:37 +0300 Subject: [PATCH] bzip2 rebuild --- system/base/bzip2/actions.py | 0 .../bzip2/files/bzip2-1.0.2-progress.patch | 0 .../files/bzip2-1.0.4-bzip2recover.patch | 0 .../files/bzip2-1.0.4-makefile-CFLAGS.patch | 25 ++++++++++++++++ .../bzip2/files/bzip2-1.0.4-man-links.patch | 0 ...2-1.0.6-nselectors-upper-bound-check.patch | 30 +++++++++++++++++++ .../base/bzip2/files/bzip2-1.0.6-saneso.patch | 0 .../bzip2/files/bzip2-1.0.6-ubsan-error.patch | 24 +++++++++++++++ .../base/bzip2/files/bzip2-1.0.8-saneso.patch | 13 ++++++++ system/base/bzip2/files/manpath.patch | 0 system/base/bzip2/pspec.xml | 9 +++++- system/base/bzip2/translations.xml | 0 12 files changed, 100 insertions(+), 1 deletion(-) mode change 100644 => 100755 system/base/bzip2/actions.py mode change 100644 => 100755 system/base/bzip2/files/bzip2-1.0.2-progress.patch mode change 100644 => 100755 system/base/bzip2/files/bzip2-1.0.4-bzip2recover.patch create mode 100644 system/base/bzip2/files/bzip2-1.0.4-makefile-CFLAGS.patch mode change 100644 => 100755 system/base/bzip2/files/bzip2-1.0.4-man-links.patch create mode 100644 system/base/bzip2/files/bzip2-1.0.6-nselectors-upper-bound-check.patch mode change 100644 => 100755 system/base/bzip2/files/bzip2-1.0.6-saneso.patch create mode 100644 system/base/bzip2/files/bzip2-1.0.6-ubsan-error.patch create mode 100644 system/base/bzip2/files/bzip2-1.0.8-saneso.patch mode change 100644 => 100755 system/base/bzip2/files/manpath.patch mode change 100644 => 100755 system/base/bzip2/pspec.xml mode change 100644 => 100755 system/base/bzip2/translations.xml diff --git a/system/base/bzip2/actions.py b/system/base/bzip2/actions.py old mode 100644 new mode 100755 diff --git a/system/base/bzip2/files/bzip2-1.0.2-progress.patch b/system/base/bzip2/files/bzip2-1.0.2-progress.patch old mode 100644 new mode 100755 diff --git a/system/base/bzip2/files/bzip2-1.0.4-bzip2recover.patch b/system/base/bzip2/files/bzip2-1.0.4-bzip2recover.patch old mode 100644 new mode 100755 diff --git a/system/base/bzip2/files/bzip2-1.0.4-makefile-CFLAGS.patch b/system/base/bzip2/files/bzip2-1.0.4-makefile-CFLAGS.patch new file mode 100644 index 00000000..04bd0d9a --- /dev/null +++ b/system/base/bzip2/files/bzip2-1.0.4-makefile-CFLAGS.patch @@ -0,0 +1,25 @@ +--- a/Makefile ++++ b/Makefile +@@ -18,10 +18,9 @@ + CC=gcc + AR=ar + RANLIB=ranlib +-LDFLAGS= + + BIGFILES=-D_FILE_OFFSET_BITS=64 +-CFLAGS=-Wall -Winline -O2 -g $(BIGFILES) ++CFLAGS+=-Wall -Winline $(BIGFILES) $(CPPFLAGS) + + # Where you want it installed when you do 'make install' + PREFIX=/usr/local +--- a/Makefile-libbz2_so ++++ b/Makefile-libbz2_so +@@ -24,7 +24,7 @@ + SHELL=/bin/sh + CC=gcc + BIGFILES=-D_FILE_OFFSET_BITS=64 +-CFLAGS=-fpic -fPIC -Wall -Winline -O2 -g $(BIGFILES) ++CFLAGS+=-fpic -fPIC -Wall -Winline $(BIGFILES) $(CPPFLAGS) + + OBJS= blocksort.o \ + huffman.o \ diff --git a/system/base/bzip2/files/bzip2-1.0.4-man-links.patch b/system/base/bzip2/files/bzip2-1.0.4-man-links.patch old mode 100644 new mode 100755 diff --git a/system/base/bzip2/files/bzip2-1.0.6-nselectors-upper-bound-check.patch b/system/base/bzip2/files/bzip2-1.0.6-nselectors-upper-bound-check.patch new file mode 100644 index 00000000..a7731f7d --- /dev/null +++ b/system/base/bzip2/files/bzip2-1.0.6-nselectors-upper-bound-check.patch @@ -0,0 +1,30 @@ +From 13ca8fee0c897121ae79ae644a212418398dfea7 Mon Sep 17 00:00:00 2001 +From: Amin Hassani +Date: Fri, 8 Mar 2019 09:58:20 -0800 +Subject: [PATCH] Check for upper bounds of nselectors. + +Currently there is no check for the upper bounds of the +nselectors. Hence, a corrupt input can cause a segfault. + +This issue was discovered by one of our fuzzers. The actual error was: + +../bzip2-1.0.6/decompress.c:299:10: runtime error: index 18002 out of bounds for type 'UChar [18002]' +--- + decompress.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/decompress.c b/decompress.c +index 311f566..391552d 100644 +--- a/decompress.c ++++ b/decompress.c +@@ -288,6 +288,7 @@ Int32 BZ2_decompress ( DState* s ) + if (nGroups < 2 || nGroups > 6) RETURN(BZ_DATA_ERROR); + GET_BITS(BZ_X_SELECTOR_2, nSelectors, 15); + if (nSelectors < 1) RETURN(BZ_DATA_ERROR); ++ if (nSelectors > BZ_MAX_SELECTORS) RETURN(BZ_DATA_ERROR); + for (i = 0; i < nSelectors; i++) { + j = 0; + while (True) { +-- +2.21.0.360.g471c308f928-goog + diff --git a/system/base/bzip2/files/bzip2-1.0.6-saneso.patch b/system/base/bzip2/files/bzip2-1.0.6-saneso.patch old mode 100644 new mode 100755 diff --git a/system/base/bzip2/files/bzip2-1.0.6-ubsan-error.patch b/system/base/bzip2/files/bzip2-1.0.6-ubsan-error.patch new file mode 100644 index 00000000..84b81117 --- /dev/null +++ b/system/base/bzip2/files/bzip2-1.0.6-ubsan-error.patch @@ -0,0 +1,24 @@ +Author: Manoj Gupta + +Use unsigned 1 for shifting instead of signed 1. + +This fixed an issue with shift caught by undefined behavior +sanitizer in clang. +bzip2-1.0.6/blocksort.c:255:7 +runtime error: left shift of 1 by 31 places cannot be represented in type 'int' + +--- a/blocksort.c ++++ b/blocksort.c +@@ -202,9 +202,9 @@ void fallbackQSort3 ( UInt32* fmap, + bhtab [ 0 .. 2+(nblock/32) ] destroyed + */ + +-#define SET_BH(zz) bhtab[(zz) >> 5] |= (1 << ((zz) & 31)) +-#define CLEAR_BH(zz) bhtab[(zz) >> 5] &= ~(1 << ((zz) & 31)) +-#define ISSET_BH(zz) (bhtab[(zz) >> 5] & (1 << ((zz) & 31))) ++#define SET_BH(zz) bhtab[(zz) >> 5] |= (1u << ((zz) & 31)) ++#define CLEAR_BH(zz) bhtab[(zz) >> 5] &= ~(1u << ((zz) & 31)) ++#define ISSET_BH(zz) (bhtab[(zz) >> 5] & (1u << ((zz) & 31))) + #define WORD_BH(zz) bhtab[(zz) >> 5] + #define UNALIGNED_BH(zz) ((zz) & 0x01f) + diff --git a/system/base/bzip2/files/bzip2-1.0.8-saneso.patch b/system/base/bzip2/files/bzip2-1.0.8-saneso.patch new file mode 100644 index 00000000..08430831 --- /dev/null +++ b/system/base/bzip2/files/bzip2-1.0.8-saneso.patch @@ -0,0 +1,13 @@ +--- bzip2-1.0.8/Makefile-libbz2_so ++++ bzip2-1.0.8/Makefile-libbz2_so +@@ -35,8 +35,8 @@ + bzlib.o + + all: $(OBJS) +- $(CC) -shared -Wl,-soname -Wl,libbz2.so.1.0 -o libbz2.so.1.0.8 $(OBJS) +- $(CC) $(CFLAGS) -o bzip2-shared bzip2.c libbz2.so.1.0.8 ++ $(CC) $(LDFLAGS) -shared -Wl,-soname -Wl,libbz2.so.1.0 -o libbz2.so.1.0.8 $(OBJS) ++ $(CC) $(LDFLAGS) $(CFLAGS) -o bzip2-shared bzip2.c libbz2.so.1.0.8 + rm -f libbz2.so.1.0 + ln -s libbz2.so.1.0.8 libbz2.so.1.0 + diff --git a/system/base/bzip2/files/manpath.patch b/system/base/bzip2/files/manpath.patch old mode 100644 new mode 100755 diff --git a/system/base/bzip2/pspec.xml b/system/base/bzip2/pspec.xml old mode 100644 new mode 100755 index 4b2189f3..ffed2383 --- a/system/base/bzip2/pspec.xml +++ b/system/base/bzip2/pspec.xml @@ -12,7 +12,7 @@ app:console A high-quality data compressor bzip2 is high-quality data compressor. It typically compresses files to within 10% to 15% of the best available techniques (the PPM family of statistical compressors), whilst being around twice as fast at compression and six times faster at decompression. - http://www.bzip.org/1.0.6/bzip2-1.0.6.tar.gz + https://sourceware.org/pub/bzip2/bzip2-1.0.6.tar.gz bzip2-1.0.2-progress.patch bzip2-1.0.4-bzip2recover.patch @@ -35,6 +35,13 @@ + + 2019-10-01 + 1.0.6 + Rebuild + Idris Kalp + idriskalp@gmail.com + 2018-07-15 1.0.6 diff --git a/system/base/bzip2/translations.xml b/system/base/bzip2/translations.xml old mode 100644 new mode 100755