From: Douglas Bagnall Date: Thu, 6 Aug 2020 05:17:01 +0000 (+1200) Subject: lzxpress: avoid technically undefined shift X-Git-Tag: talloc-2.3.2~662 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=0c461f3bd589764c496b530f698e313df50667e6;p=thirdparty%2Fsamba.git lzxpress: avoid technically undefined shift UBSAN: runtime error: left shift of 1 by 31 places cannot be represented in type 'int' Credit to OSS-fuzz. REF: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=22283 Signed-off-by: Douglas Bagnall Reviewed-by: Gary Lockyer Autobuild-User(master): Jeremy Allison Autobuild-Date(master): Mon Aug 31 22:31:13 UTC 2020 on sn-devel-184 --- diff --git a/lib/compression/lzxpress.c b/lib/compression/lzxpress.c index d8326304455..3453dd36f2a 100644 --- a/lib/compression/lzxpress.c +++ b/lib/compression/lzxpress.c @@ -180,7 +180,7 @@ ssize_t lzxpress_compress(const uint8_t *uncompressed, } } - indic |= 1 << (32 - ((indic_bit % 32) + 1)); + indic |= 1U << (32 - ((indic_bit % 32) + 1)); if (best_len > 9) { if (nibble_index == 0) {