bzip2 rebuild

This commit is contained in:
IdrisKalp
2019-12-11 01:50:37 +03:00
parent 4b088a77f5
commit 82057c4984
12 changed files with 100 additions and 1 deletions
Regular → Executable
View File
View File
View File
@@ -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 \
View File
@@ -0,0 +1,30 @@
From 13ca8fee0c897121ae79ae644a212418398dfea7 Mon Sep 17 00:00:00 2001
From: Amin Hassani <ahassani@chromium.org>
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
View File
@@ -0,0 +1,24 @@
Author: Manoj Gupta <manojgupta@google.com>
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)
@@ -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
View File
Regular → Executable
+8 -1
View File
@@ -12,7 +12,7 @@
<IsA>app:console</IsA>
<Summary>A high-quality data compressor</Summary>
<Description>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.</Description>
<Archive sha1sum="3f89f861209ce81a6bab1fd1998c0ef311712002" type="targz">http://www.bzip.org/1.0.6/bzip2-1.0.6.tar.gz</Archive>
<Archive sha1sum="3f89f861209ce81a6bab1fd1998c0ef311712002" type="targz">https://sourceware.org/pub/bzip2/bzip2-1.0.6.tar.gz</Archive>
<Patches>
<Patch level="1">bzip2-1.0.2-progress.patch</Patch>
<Patch level="1">bzip2-1.0.4-bzip2recover.patch</Patch>
@@ -35,6 +35,13 @@
</Package>
<History>
<Update release="5">
<Date>2019-10-01</Date>
<Version>1.0.6</Version>
<Comment>Rebuild</Comment>
<Name>Idris Kalp</Name>
<Email>idriskalp@gmail.com</Email>
</Update>
<Update release="4">
<Date>2018-07-15</Date>
<Version>1.0.6</Version>
View File