public inbox for gdb-testers@sourceware.org
help / color / mirror / Atom feed
From: gdb-buildbot@sergiodj.net
To: gdb-testers@sourceware.org
Subject: [binutils-gdb] Bugfixes for pe_print_debugdata()
Date: Thu, 30 Jan 2020 17:52:00 -0000	[thread overview]
Message-ID: <87b2920fc54826c2a0015ab3a19b7b873d208653@gdb-build> (raw)

*** TEST RESULTS FOR COMMIT 87b2920fc54826c2a0015ab3a19b7b873d208653 ***

commit 87b2920fc54826c2a0015ab3a19b7b873d208653
Author:     Jon Turney <jon.turney@dronecode.org.uk>
AuthorDate: Wed Jan 15 18:48:13 2020 +0000
Commit:     Jon Turney <jon.turney@dronecode.org.uk>
CommitDate: Thu Jan 30 13:06:24 2020 +0000

    Bugfixes for pe_print_debugdata()
    
    Use a separate iteration variable for inner loop (:blush:).  This
    generally prevented any debug directory entries after a
    IMAGE_DEBUG_TYPE_CODEVIEW entry from being reported.
    
    Don't leak the memory allocated for the section containing the debug
    directory.
    
    bfd/ChangeLog:
    
    2020-01-16  Jon Turney  <jon.turney@dronecode.org.uk>
    
            * peXXigen.c (pe_print_debugdata): Fix the iteration variable for
            inner loop.  Fix a memory leak.

diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 1e2740eacc..58af683172 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,8 @@
+2020-01-16  Jon Turney  <jon.turney@dronecode.org.uk>
+
+	* peXXigen.c (pe_print_debugdata): Fix the iteration variable for
+	inner loop.  Fix a memory leak.
+
 2020-01-30  Alan Modra  <amodra@gmail.com>
 
 	* coffgen.c (coff_real_object_p): Don't clear obj_coff_keep_syms
diff --git a/bfd/peXXigen.c b/bfd/peXXigen.c
index c5082a7dee..ac0cf17464 100644
--- a/bfd/peXXigen.c
+++ b/bfd/peXXigen.c
@@ -2630,7 +2630,7 @@ pe_print_debugdata (bfd * abfd, void * vfile)
   asection *section;
   bfd_byte *data = 0;
   bfd_size_type dataoff;
-  unsigned int i;
+  unsigned int i, j;
 
   bfd_vma addr = extra->DataDirectory[PE_DEBUG_DATA].VirtualAddress;
   bfd_size_type size = extra->DataDirectory[PE_DEBUG_DATA].Size;
@@ -2722,8 +2722,8 @@ pe_print_debugdata (bfd * abfd, void * vfile)
 					       idd.SizeOfData, cvinfo))
 	    continue;
 
-	  for (i = 0; i < cvinfo->SignatureLength; i++)
-	    sprintf (&signature[i*2], "%02x", cvinfo->Signature[i] & 0xff);
+	  for (j = 0; j < cvinfo->SignatureLength; j++)
+	    sprintf (&signature[j*2], "%02x", cvinfo->Signature[j] & 0xff);
 
 	  /* xgettext:c-format */
 	  fprintf (file, _("(format %c%c%c%c signature %s age %ld)\n"),
@@ -2732,6 +2732,8 @@ pe_print_debugdata (bfd * abfd, void * vfile)
 	}
     }
 
+  free(data);
+
   if (size % sizeof (struct external_IMAGE_DEBUG_DIRECTORY) != 0)
     fprintf (file,
 	    _("The debug directory size is not a multiple of the debug directory entry size\n"));


             reply	other threads:[~2020-01-30 17:22 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-30 17:52 gdb-buildbot [this message]
2020-01-30 17:24 ` Failures on Fedora-x86_64-m32, branch master gdb-buildbot
2020-01-30 18:16 ` Failures on Fedora-x86_64-cc-with-index, " gdb-buildbot
2020-01-30 18:19 ` Failures on Fedora-x86_64-m64, " gdb-buildbot
2020-01-30 18:38 ` Failures on Fedora-x86_64-native-extended-gdbserver-m32, " gdb-buildbot
2020-01-30 18:58 ` Failures on Fedora-x86_64-native-extended-gdbserver-m64, " gdb-buildbot
2020-01-30 19:59 ` Failures on Ubuntu-Aarch64-native-extended-gdbserver-m64, " gdb-buildbot
2020-01-30 21:00 ` Failures on Fedora-x86_64-native-gdbserver-m32, " gdb-buildbot
2020-01-30 21:38 ` Failures on Ubuntu-Aarch64-native-gdbserver-m64, " gdb-buildbot
2020-01-30 21:45 ` Failures on Fedora-x86_64-native-gdbserver-m64, " gdb-buildbot

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:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

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

  git send-email \
    --in-reply-to=87b2920fc54826c2a0015ab3a19b7b873d208653@gdb-build \
    --to=gdb-buildbot@sergiodj.net \
    --cc=gdb-testers@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* 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).