[sdl-qemu] [PATCH] disas/sparc: Fix integer overflow in compare_opcodes()

2025-02-18 Thread zeff
From: Denis Sergeev Fix an integer overflow issue caused by a left shift operation (1 << i) on an int literal. For i >= 31, this could lead to undefined behavior by exceeding the 32-bit range. To prevent this, explicitly cast the literal to an unsigned long int (1UL << i), ensuring the shift ope

Re: [sdl-qemu] [PATCH] disas/sparc: Fix integer overflow in compare_opcodes()

2025-02-18 Thread Peter Maydell
On Tue, 18 Feb 2025 at 09:00, wrote: > > From: Denis Sergeev > > Fix an integer overflow issue caused by a left shift operation (1 << i) > on an int literal. For i >= 31, this could lead to undefined behavior by > exceeding the 32-bit range. The only case here where i >= 31 is exactly i == 31. Q