[binutils-gdb] libiberty d_compact_number signed integer overflow
Alan Modra
amodra@sourceware.org
Wed Jul 1 01:44:59 GMT 2026
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=54e80f9747d62efea50038655801ecb58d37b507
commit 54e80f9747d62efea50038655801ecb58d37b507
Author: Alan Modra <amodra@gmail.com>
Date: Wed Jul 1 10:57:51 2026 +0930
libiberty d_compact_number signed integer overflow
https://lists.gnu.org/archive/html/bug-binutils/2026-06/msg00189.html
Fix this by doing the addition in unsigned arithmetic.
Diff:
---
libiberty/cp-demangle.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libiberty/cp-demangle.c b/libiberty/cp-demangle.c
index 5f08ef8946a..ab122fc388d 100644
--- a/libiberty/cp-demangle.c
+++ b/libiberty/cp-demangle.c
@@ -3266,7 +3266,7 @@ d_compact_number (struct d_info *di)
else if (d_peek_char (di) == 'n')
return -1;
else
- num = d_number (di) + 1;
+ num = d_number (di) + 1u;
if (num < 0 || ! d_check_char (di, '_'))
return -1;
More information about the Binutils-cvs
mailing list