https://gcc.gnu.org/g:d9d9119bf2f3114a24ea297db12142eb2457bfb5

commit r17-2033-gd9d9119bf2f3114a24ea297db12142eb2457bfb5
Author: Alan Modra <[email protected]>
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.
    
            * cp-demangle.c (d_compact_number): Avoid signed overflow.

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 5f08ef8946af..ab122fc388d2 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;

Reply via email to