bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug binutils/15106] New: Segfault in elf_find_function


From: ra.vitillo at gmail dot com
Subject: [Bug binutils/15106] New: Segfault in elf_find_function
Date: Wed, 06 Feb 2013 17:55:35 +0000

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: address@hidden
        ReportedBy: address@hidden
                CC: address@hidden
    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.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]