This is the mail archive of the binutils-cvs@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[binutils-gdb] Fix memory corruption on Mach-O systems by suppressing a memory tidy up.


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=cf466c2ac5ac55bb9b30b96fbdcad564e8c1ccc8

commit cf466c2ac5ac55bb9b30b96fbdcad564e8c1ccc8
Author: Nick Clifton <nickc@redhat.com>
Date:   Mon Jan 25 09:35:33 2016 +0000

    Fix memory corruption on Mach-O systems by suppressing a memory tidy up.
    
    	PR target/19435
    	* mach-o.c (bfd_mach_o_close_and_cleanup): Suppress code to free
    	dsym filename buffer.

Diff:
---
 bfd/ChangeLog |  6 ++++++
 bfd/mach-o.c  | 12 ++++++++++++
 2 files changed, 18 insertions(+)

diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index abf583b..dcd6ea1 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,9 @@
+2016-01-25  Nick Clifton  <nickc@redhat.com>
+
+	PR target/19435
+	* mach-o.c (bfd_mach_o_close_and_cleanup): Suppress code to free
+	dsym filename buffer.
+
 2016-01-24  Maciej W. Rozycki  <macro@imgtec.com>
 
 	* elfxx-mips.c (BZ16_REG_FIELD): Simplify calculation.
diff --git a/bfd/mach-o.c b/bfd/mach-o.c
index 72454f9..0f39157 100644
--- a/bfd/mach-o.c
+++ b/bfd/mach-o.c
@@ -5798,14 +5798,26 @@ bfd_mach_o_close_and_cleanup (bfd *abfd)
       if (mdata->dsym_bfd != NULL)
         {
           bfd *fat_bfd = mdata->dsym_bfd->my_archive;
+#if 0
+	  /* FIXME: PR 19435: This calculation to find the memory allocated by
+	     bfd_mach_o_follow_dsym for the filename does not always end up
+	     selecting the correct pointer.  Unfortunately this problem is
+	     very hard to reproduce on a non Mach-O native system, so until it
+	     can be traced and fixed on such a system, this code will remain
+	     commented out.  This does mean that there will be a memory leak,
+	     but it is small, and happens when we are closing down, so it
+	     should not matter too much.
           char *dsym_filename = (char *)(fat_bfd
                                          ? fat_bfd->filename
                                          : mdata->dsym_bfd->filename);
+#endif
           bfd_close (mdata->dsym_bfd);
           mdata->dsym_bfd = NULL;
           if (fat_bfd)
             bfd_close (fat_bfd);
+#if 0
           free (dsym_filename);
+#endif
         }
     }


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]