From: Thomas Weißschuh Date: Tue, 13 Dec 2022 02:40:02 +0000 (+0000) Subject: iso9660.h: avoid undefined signed integer shift X-Git-Tag: v2.39-rc1~366^2~1 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=893fe60d0b8f14d9a3022f6f95637e43b17f1b8b;p=thirdparty%2Futil-linux.git iso9660.h: avoid undefined signed integer shift When the high bit in p[3] is set we would overflow our signed 4-byte integer result value. Force an unsigned type instead. --- diff --git a/include/iso9660.h b/include/iso9660.h index cbc45dbb47..ed402d8c80 100644 --- a/include/iso9660.h +++ b/include/iso9660.h @@ -34,7 +34,7 @@ static inline uint32_t isonum_731(const unsigned char *p) return ((p[0] & 0xff) | ((p[1] & 0xff) << 8) | ((p[2] & 0xff) << 16) - | ((p[3] & 0xff) << 24)); + | (((uint32_t) p[3] & 0xff) << 24)); } static inline uint32_t isonum_732(const unsigned char *p) @@ -42,7 +42,7 @@ static inline uint32_t isonum_732(const unsigned char *p) return ((p[3] & 0xff) | ((p[2] & 0xff) << 8) | ((p[1] & 0xff) << 16) - | ((p[0] & 0xff) << 24)); + | (((uint32_t) p[0] & 0xff) << 24)); } static inline uint32_t isonum_733(const unsigned char *p, bool check_match)