From 17c59f8f683050453f2338fea691131c6584d14c Mon Sep 17 00:00:00 2001 From: Stefan Reinauer Date: Wed, 20 May 2026 17:37:36 -0700 Subject: [PATCH] isofs: avoid undefined timezone sign extension make_date() sign-extends the ISO9660 timezone byte when the high bit is set. (-1 << 8) shifts a negative signed value, which is undefined behavior in C++. Use ~0xff to build the same extension mask without relying on that undefined shift. --- isofs.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/isofs.cpp b/isofs.cpp index d40bd1b9..5fb47a30 100644 --- a/isofs.cpp +++ b/isofs.cpp @@ -328,7 +328,7 @@ static int make_date(int year, int month, int day, int hour, int minute, int sec /* sign extend */ if (tz & 0x80) - tz |= (-1 << 8); + tz |= ~0xff; /* * The timezone offset is unreliable on some disks, -- 2.47.3