public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Alan Modra <amodra@gmail.com>
To: binutils@sourceware.org
Subject: Re: objdump read_section_stabs
Date: Wed, 22 Feb 2023 09:31:39 +1030	[thread overview]
Message-ID: <Y/VNU3lLkTwid8ab@squeak.grove.modra.org> (raw)

Commit f9c36cc99518 changed (and renamed) read_section_stabs with one
difference in overall behaviour.  Previously read_section_stabs would
return a NULL for an empty section, which was then treated the same as
a missing section.  Now an empty section is recognized and dumped.
This leads to NULL stabp and stabs_end in print_section_stabs.  Since
stabs_end - STABSIZE is then a pointer to a very large address, the
test "stabp < stabs_end - STABSIZE" succeeds.

	* objdump.c (print_section_stabs): Correct STABSIZE comparison.

diff --git a/binutils/objdump.c b/binutils/objdump.c
index 984c7219a0c..40ed6882b45 100644
--- a/binutils/objdump.c
+++ b/binutils/objdump.c
@@ -4508,7 +4508,7 @@ print_section_stabs (bfd *abfd,
 
      We start the index at -1 because there is a dummy symbol on
      the front of stabs-in-{coff,elf} sections that supplies sizes.  */
-  for (i = -1; stabp <= stabs_end - STABSIZE; stabp += STABSIZE, i++)
+  for (i = -1; (size_t) (stabs_end - stabp) >= STABSIZE; stabp += STABSIZE, i++)
     {
       const char *name;
       unsigned long strx;

-- 
Alan Modra
Australia Development Lab, IBM

             reply	other threads:[~2023-02-21 23:01 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-21 23:01 Alan Modra [this message]
  -- strict thread matches above, loose matches on Subject: below --
2023-02-21 23:34 Alan Modra
2023-02-15 11:35 Alan Modra

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=Y/VNU3lLkTwid8ab@squeak.grove.modra.org \
    --to=amodra@gmail.com \
    --cc=binutils@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).