summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorManoj Gupta <manojgupta@google.com>2018-08-24 19:43:58 +0200
committerThomas Deutschmann <whissi@gentoo.org>2018-08-24 19:47:29 +0200
commit66f614c51f017b0693f5aaeb5897db28ef3aff6c (patch)
tree63e00f289f7f7450c892f18ee7f2c4a8b5105d9c /app-arch/bzip2
parentwww-servers/apache: process tmpfiles in pkg_postinst phase (diff)
downloadgentoo-66f614c51f017b0693f5aaeb5897db28ef3aff6c.tar.gz
gentoo-66f614c51f017b0693f5aaeb5897db28ef3aff6c.tar.bz2
gentoo-66f614c51f017b0693f5aaeb5897db28ef3aff6c.zip
app-arch/bzip2: fix an error reported by ubsan
Use unsigned 1 for shifting instead of signed 1. Fix 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'. Closes: https://github.com/gentoo/gentoo/pull/9688 Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>
Diffstat (limited to 'app-arch/bzip2')
-rw-r--r--app-arch/bzip2/bzip2-1.0.6-r10.ebuild (renamed from app-arch/bzip2/bzip2-1.0.6-r9.ebuild)1
-rw-r--r--app-arch/bzip2/files/bzip2-1.0.6-ubsan-error.patch24
2 files changed, 25 insertions, 0 deletions
diff --git a/app-arch/bzip2/bzip2-1.0.6-r9.ebuild b/app-arch/bzip2/bzip2-1.0.6-r10.ebuild
index b2bae1f09890..5fb91d277fa8 100644
--- a/app-arch/bzip2/bzip2-1.0.6-r9.ebuild
+++ b/app-arch/bzip2/bzip2-1.0.6-r10.ebuild
@@ -27,6 +27,7 @@ PATCHES=(
"${FILESDIR}"/${PN}-1.0.6-mingw.patch #393573
"${FILESDIR}"/${PN}-1.0.6-out-of-tree-build.patch
"${FILESDIR}"/${PN}-1.0.6-CVE-2016-3189.patch #620466
+ "${FILESDIR}"/${PN}-1.0.6-ubsan-error.patch
)
DOCS=( CHANGES README{,.COMPILATION.PROBLEMS,.XML.STUFF} manual.pdf )
diff --git a/app-arch/bzip2/files/bzip2-1.0.6-ubsan-error.patch b/app-arch/bzip2/files/bzip2-1.0.6-ubsan-error.patch
new file mode 100644
index 000000000000..84b811177ed5
--- /dev/null
+++ b/app-arch/bzip2/files/bzip2-1.0.6-ubsan-error.patch
@@ -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)
+