PR28753, buffer overflow in read_section_stabs_debugging_info
authorAlan Modra <amodra@gmail.com>
Thu, 20 Jan 2022 03:28:38 +0000 (13:58 +1030)
committerAlan Modra <amodra@gmail.com>
Fri, 28 Jan 2022 01:24:54 +0000 (11:54 +1030)
PR 28753
* rddbg.c (read_section_stabs_debugging_info): Don't read past
end of section when concatentating stab strings.

binutils/rddbg.c

index 42605b83d1aedf63e4c7511a19b68662a0940025..169c52f498322bda956a9cd5764889e01ed3ece1 100644 (file)
@@ -210,7 +210,7 @@ read_section_stabs_debugging_info (bfd *abfd, asymbol **syms, long symcount,
                     an attempt to read the byte before 'strings' would occur.  */
                  while ((len = strlen (s)) > 0
                         && s[len  - 1] == '\\'
-                        && stab + 12 < stabs + stabsize)
+                        && stab + 16 <= stabs + stabsize)
                    {
                      char *p;