From: Nathan Moinvaziri Date: Mon, 5 Oct 2020 01:36:25 +0000 (-0700) Subject: Fixed left shift ubsan warning in PULLBYTE. X-Git-Tag: v2.0.0-RC1~39 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=05d4a0857a1ac57287af01d0007cdb1ac05e2b29;p=thirdparty%2Fzlib-ng.git Fixed left shift ubsan warning in PULLBYTE. infback.c:200:13: runtime error: left shift of 255 by 24 places cannot be represented in type 'int' 624: SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior /Users/runner/work/zlib-ng/zlib-ng/infback.c:200:13 in --- diff --git a/infback.c b/infback.c index 22599f0e..eecf03ad 100644 --- a/infback.c +++ b/infback.c @@ -80,7 +80,7 @@ int32_t Z_EXPORT PREFIX(inflateBackInit_)(PREFIX3(stream) *strm, int32_t windowB do { \ PULL(); \ have--; \ - hold += (*next++ << bits); \ + hold += ((unsigned)(*next++) << bits); \ bits += 8; \ } while (0)