http://sourceware.org/bugzilla/show_bug.cgi?id=15106

             Bug #: 15106
           Summary: Segfault in elf_find_function
           Product: binutils
           Version: 2.23
            Status: NEW
          Severity: normal
          Priority: P2
         Component: binutils
        AssignedTo: unassig...@sourceware.org
        ReportedBy: ra.viti...@gmail.com
                CC: amo...@gmail.com
    Classification: Unclassified


The caching of the last function sym info in elf_find_function causes a
segfault when last_section == section but the pointer to symbols has changed
from the last invocation and func is not a valid pointer anymore.

The following patch fixes this bug:
diff --git a/elf.c b/elf.c
--- a/elf.c
+++ b/elf.c
@@ -7475,6 +7475,7 @@ elf_find_function (bfd *abfd,
                   const char **functionname_ptr)
 {
   static asection *last_section;
+  static asymbol **last_symbols;
   static asymbol *func;
   static const char *filename;
   static bfd_size_type func_size;
@@ -7483,6 +7484,7 @@ elf_find_function (bfd *abfd,
     return FALSE;

   if (last_section != section
+      || last_symbols != symbols
       || func == NULL
       || offset < func->value
       || offset >= func->value + func_size)
@@ -7531,6 +7533,7 @@ elf_find_function (bfd *abfd,
                      && size > func_size)))
            {
              func = sym;
+             last_symbols = symbols;
              func_size = size;
              low_func = code_off;

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

_______________________________________________
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils

Reply via email to