* [PATCH v3 1/2] disas/sparc: Fix integer overflow in compare_opcodes
@ 2026-03-15 4:28 Aadhya-R
0 siblings, 0 replies; only message in thread
From: Aadhya-R @ 2026-03-15 4:28 UTC (permalink / raw)
To: mark.cave-ayland; +Cc: qemu-devel, qemu-trivial
Change '1 << i' to '1ul << i' to prevent undefined behavior when shifting into the sign bit on the 31st iteration. Resolves SVACE static analyzer warning.
---
disas/sparc.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/disas/sparc.c b/disas/sparc.c
index 5689533ce1..40c1164554 100644
--- a/disas/sparc.c
+++ b/disas/sparc.c
@@ -2515,7 +2515,7 @@ compare_opcodes (const void * a, const void * b)
another, it is important to order the opcodes in the right order. */
for (i = 0; i < 32; ++i)
{
- unsigned long int x = 1 << i;
+ unsigned long int x = 1ul << i;
int x0 = (match0 & x) != 0;
int x1 = (match1 & x) != 0;
@@ -2525,7 +2525,7 @@ compare_opcodes (const void * a, const void * b)
for (i = 0; i < 32; ++i)
{
- unsigned long int x = 1 << i;
+ unsigned long int x = 1ul << i;
int x0 = (lose0 & x) != 0;
int x1 = (lose1 & x) != 0;
--
2.43.0
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2026-03-15 13:03 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-15 4:28 [PATCH v3 1/2] disas/sparc: Fix integer overflow in compare_opcodes Aadhya-R
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.