Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/external/bsd/jemalloc/include/jemalloc/internal Fix undefine...



details:   https://anonhg.NetBSD.org/src/rev/96ee988f087e
branches:  trunk
changeset: 848905:96ee988f087e
user:      kamil <kamil%NetBSD.org@localhost>
date:      Fri Feb 14 01:52:35 2020 +0000

description:
Fix undefined behavior in hash.h (jemalloc)

Cherry-pick upstream patch:

    Fix Undefined Behavior in hash.h

    hash.h:200:27, left shift of 250 by 24 places cannot be represented in type 'int'

https://github.com/jemalloc/jemalloc/commit/7fd22f7b2ea5ce2540563ece8e2d30a5316ac857

diffstat:

 external/bsd/jemalloc/include/jemalloc/internal/hash.h |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (28 lines):

diff -r 7d430df9095b -r 96ee988f087e external/bsd/jemalloc/include/jemalloc/internal/hash.h
--- a/external/bsd/jemalloc/include/jemalloc/internal/hash.h    Thu Feb 13 23:05:53 2020 +0000
+++ b/external/bsd/jemalloc/include/jemalloc/internal/hash.h    Fri Feb 14 01:52:35 2020 +0000
@@ -183,21 +183,21 @@
                        k4 *= c4; k4 = hash_rotl_32(k4, 18); k4 *= c1; h4 ^= k4;
                        /*FALLTHROUGH*/
 
-               case 12: k3 ^= tail[11] << 24;  /*FALLTHROUGH*/
+               case 12: k3 ^= (uint32_t)tail[11] << 24;        /*FALLTHROUGH*/
                case 11: k3 ^= tail[10] << 16;  /*FALLTHROUGH*/
                case 10: k3 ^= tail[ 9] << 8;   /*FALLTHROUGH*/
                case  9: k3 ^= tail[ 8] << 0;
                        k3 *= c3; k3 = hash_rotl_32(k3, 17); k3 *= c4; h3 ^= k3;
                        /*FALLTHROUGH*/
 
-               case  8: k2 ^= tail[ 7] << 24;  /*FALLTHROUGH*/
+               case  8: k2 ^= (uint32_t)tail[ 7] << 24;        /*FALLTHROUGH*/
                case  7: k2 ^= tail[ 6] << 16;  /*FALLTHROUGH*/
                case  6: k2 ^= tail[ 5] << 8;   /*FALLTHROUGH*/
                case  5: k2 ^= tail[ 4] << 0;
                        k2 *= c2; k2 = hash_rotl_32(k2, 16); k2 *= c3; h2 ^= k2;
                        /*FALLTHROUGH*/
 
-               case  4: k1 ^= tail[ 3] << 24;  /*FALLTHROUGH*/
+               case  4: k1 ^= (uint32_t)tail[ 3] << 24;        /*FALLTHROUGH*/
                case  3: k1 ^= tail[ 2] << 16;  /*FALLTHROUGH*/
                case  2: k1 ^= tail[ 1] << 8;   /*FALLTHROUGH*/
                case  1: k1 ^= tail[ 0] << 0;



Home | Main Index | Thread Index | Old Index