public inbox for
 help / color / mirror / Atom feed
From: Manfred Hollstein <>
Subject: PATCH for bfd in binutils-2.9.1/gdb-4.17
Date: Tue, 23 Feb 1999 08:18:00 -0000	[thread overview]
Message-ID: <> (raw)

This small patch fixes a bug I observed while running gdb-4.17
on a mips-sgi-irix5.3 system.  Since the debuggee's debug info
was larger than the system's virtual memory was able to provide,
the "goto error_return" in bfd/elf32-mips.c:_bfd_mips_elf_read_ecoff_info
got executed, which in turn tries to cleanup allocated memory.
Unfortunately, it's simply checking probably unitialized
memory to decide whether it should.



1999-02-23  Manfred Hollstein  <>

	* elf32-mips.c (_bfd_mips_elf_read_ecoff_info): Ensure only actually
	allocated members will be free'ed at error_return.

diff -rup -x CVS -x RCS -x *.o -x *.info* -x *.html* -x *.elc -x *.dvi -x *.orig -x *~ -x version.el binutils-2.9.1.orig/bfd/elf32-mips.c binutils-2.9.1/bfd/elf32-mips.c
--- binutils-2.9.1.orig/bfd/elf32-mips.c	Fri May  1 17:48:09 1998
+++ binutils-2.9.1/bfd/elf32-mips.c	Tue Feb 23 16:27:52 1999
@@ -2904,6 +2904,20 @@ _bfd_mips_elf_read_ecoff_info (abfd, sec
   swap = get_elf_backend_data (abfd)->elf_backend_ecoff_debug_swap;
+  /* Ensure only actually allocated members will be free'ed at
+     error_return.  */
+  debug->line = NULL;
+  debug->external_dnr = NULL;
+  debug->external_pdr = NULL;
+  debug->external_sym = NULL;
+  debug->external_opt = NULL;
+  debug->external_aux = NULL;
+  debug->ss = NULL;
+  debug->ssext = NULL;
+  debug->external_fdr = NULL;
+  debug->external_rfd = NULL;
+  debug->external_ext = NULL;
   ext_hdr = (char *) bfd_malloc ((size_t) swap->external_hdr_size);
   if (ext_hdr == NULL && swap->external_hdr_size != 0)
     goto error_return;

             reply	other threads:[~1999-02-23  8:18 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-02-23  8:18 Manfred Hollstein [this message]
1999-04-14  9:08 ` PATCH: fix unitialized memory reads in bfd/elf32-mips.c Manfred Hollstein

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \ \ \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).