From 893fe60d0b8f14d9a3022f6f95637e43b17f1b8b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Thomas=20Wei=C3=9Fschuh?= <thomas@t-8ch.de>
Date: Tue, 13 Dec 2022 02:40:02 +0000
Subject: [PATCH] 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.
---
 include/iso9660.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/iso9660.h b/include/iso9660.h
index cbc45dbb4..ed402d8c8 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)
-- 
2.27.0

