]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
ubsan: size_inc_line_addr integer overflow
authorAlan Modra <amodra@gmail.com>
Sat, 10 May 2025 02:47:23 +0000 (12:17 +0930)
committerAlan Modra <amodra@gmail.com>
Sun, 11 May 2025 13:22:32 +0000 (22:52 +0930)
Fix a fuzzer testcase where a large positive line_delta causes signed
overflow when subtracting -5.  Signed overflow is perfectly OK here.

gas/dwarf2dbg.c

index 2963e52958a30cfed2529bcdb699d87d902b6353..955119bd87af7edc9d80e044c7d1196465a37978 100644 (file)
@@ -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.  */