From a21cfe2381095d2ddd0e02c58aa7701f6cfbcf3b Mon Sep 17 00:00:00 2001 From: g00523939 Date: Tue, 16 Nov 2021 11:52:12 +0800 Subject: [PATCH] fix undefined behavior in hash.h --- ...tch-2-fix-undefined-behavior-in-hash.patch | 26 +++++++++++++++++++ jemalloc.spec | 8 ++++-- 2 files changed, 32 insertions(+), 2 deletions(-) create mode 100644 backport-Jemalloc-5.2.1-patch-2-fix-undefined-behavior-in-hash.patch diff --git a/backport-Jemalloc-5.2.1-patch-2-fix-undefined-behavior-in-hash.patch b/backport-Jemalloc-5.2.1-patch-2-fix-undefined-behavior-in-hash.patch new file mode 100644 index 0000000..bc2cccb --- /dev/null +++ b/backport-Jemalloc-5.2.1-patch-2-fix-undefined-behavior-in-hash.patch @@ -0,0 +1,26 @@ +diff -Nur jemalloc-5.2.1/include/jemalloc/internal/hash.h tmp/include/jemalloc/internal/hash.h +--- jemalloc-5.2.1/include/jemalloc/internal/hash.h 2019-08-06 04:02:00.000000000 +0800 ++++ tmp/include/jemalloc/internal/hash.h 2021-11-16 10:49:41.199628212 +0800 +@@ -182,19 +182,19 @@ + case 13: k4 ^= tail[12] << 0; + k4 *= c4; k4 = hash_rotl_32(k4, 18); k4 *= c1; h4 ^= k4; + JEMALLOC_FALLTHROUGH +- case 12: k3 ^= tail[11] << 24; JEMALLOC_FALLTHROUGH ++ case 12: k3 ^= (uint32_t) tail[11] << 24; JEMALLOC_FALLTHROUGH + case 11: k3 ^= tail[10] << 16; JEMALLOC_FALLTHROUGH + case 10: k3 ^= tail[ 9] << 8; JEMALLOC_FALLTHROUGH + case 9: k3 ^= tail[ 8] << 0; + k3 *= c3; k3 = hash_rotl_32(k3, 17); k3 *= c4; h3 ^= k3; + JEMALLOC_FALLTHROUGH +- case 8: k2 ^= tail[ 7] << 24; JEMALLOC_FALLTHROUGH ++ case 8: k2 ^= (uint32_t) tail[ 7] << 24; JEMALLOC_FALLTHROUGH + case 7: k2 ^= tail[ 6] << 16; JEMALLOC_FALLTHROUGH + case 6: k2 ^= tail[ 5] << 8; JEMALLOC_FALLTHROUGH + case 5: k2 ^= tail[ 4] << 0; + k2 *= c2; k2 = hash_rotl_32(k2, 16); k2 *= c3; h2 ^= k2; + JEMALLOC_FALLTHROUGH +- case 4: k1 ^= tail[ 3] << 24; JEMALLOC_FALLTHROUGH ++ case 4: k1 ^= (uint32_t) tail[ 3] << 24; JEMALLOC_FALLTHROUGH + case 3: k1 ^= tail[ 2] << 16; JEMALLOC_FALLTHROUGH + case 2: k1 ^= tail[ 1] << 8; JEMALLOC_FALLTHROUGH + case 1: k1 ^= tail[ 0] << 0; diff --git a/jemalloc.spec b/jemalloc.spec index ab8bd1d..6503f2c 100644 --- a/jemalloc.spec +++ b/jemalloc.spec @@ -12,13 +12,14 @@ Name: jemalloc Version: 5.2.1 -Release: 2 +Release: 3 Summary: General-purpose scalable concurrent malloc implementation License: BSD URL: http://www.canonware.com/jemalloc/ Source0: https://github.com/jemalloc/%{name}/releases/download/%{version}/%{name}-%{version}.tar.bz2 Patch1: backport-Jemalloc-5.2.1-patch-1-fix-large-bin-index-accessed-through-cache-bin-descriptor.patch +Patch2: backport-Jemalloc-5.2.1-patch-2-fix-undefined-behavior-in-hash.patch BuildRequires: libxslt perl-generators gcc %description @@ -82,7 +83,10 @@ make check %{_mandir}/man3/jemalloc.3* %changelog -* Wed Nov 3 2021 guominghong - 5.2.1-1 +* Tue Nov 16 2021 guominghong - 5.2.1-3 +- Fix Undefined Behavior in hash.h + +* Wed Nov 3 2021 guominghong - 5.2.1-2 - Fix large bin index accessed through cache bin descriptor * Tue Jul 20 2021 weidong - 5.2.1-1 -- Gitee