[binutils-gdb] ubsan: size_inc_line_addr integer overflow

Alan Modra amodra@sourceware.org
Sun May 11 13:28:07 GMT 2025


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=07cf922195d1e2eb1481da04048858b9d32928b6

commit 07cf922195d1e2eb1481da04048858b9d32928b6
Author: Alan Modra <amodra@gmail.com>
Date:   Sat May 10 12:17:23 2025 +0930

    ubsan: size_inc_line_addr integer overflow
    
    Fix a fuzzer testcase where a large positive line_delta causes signed
    overflow when subtracting -5.  Signed overflow is perfectly OK here.

Diff:
---
 gas/dwarf2dbg.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gas/dwarf2dbg.c b/gas/dwarf2dbg.c
index 2963e52958a..955119bd87a 100644
--- a/gas/dwarf2dbg.c
+++ b/gas/dwarf2dbg.c
@@ -1632,7 +1632,7 @@ size_inc_line_addr (int line_delta, addressT addr_delta)
     }
 
   /* Bias the line delta by the base.  */
-  tmp = line_delta - DWARF2_LINE_BASE;
+  tmp = (unsigned) line_delta - DWARF2_LINE_BASE;
 
   /* If the line increment is out of range of a special opcode, we
      must encode it with DW_LNS_advance_line.  */


More information about the Binutils-cvs mailing list