Re: objdump read_section_stabs
authorAlan Modra <amodra@gmail.com>
Tue, 21 Feb 2023 23:27:53 +0000 (09:57 +1030)
committerAlan Modra <amodra@gmail.com>
Tue, 21 Feb 2023 23:31:10 +0000 (10:01 +1030)
Also fix ubsan "applying zero offset to null pointer".

* objdump.c (print_section_stabs): Avoid ubsan warning.

binutils/objdump.c

index 40ed6882b453c2705b25ef8aa70d6dc33260bc61..d00eed054c4c81ecfdb9dbed5cf8559ff70e7c49 100644 (file)
@@ -4499,7 +4499,7 @@ print_section_stabs (bfd *abfd,
   bfd_byte *stabp, *stabs_end;
 
   stabp = stabs;
-  stabs_end = stabp + stab_size;
+  stabs_end = PTR_ADD (stabp, stab_size);
 
   printf (_("Contents of %s section:\n\n"), sanitize_string (stabsect_name));
   printf ("Symnum n_type n_othr n_desc n_value  n_strx String\n");