From: Alan Modra <amodra@gmail.com>
To: binutils@sourceware.org
Subject: PR31692, objdump fails .debug_info size check
Date: Thu, 2 May 2024 20:37:27 +0930 [thread overview]
Message-ID: <ZjNz7wGwHoOSfCJV@squeak.grove.modra.org> (raw)
PR 31692
* objdump.c (load_specific_debug_section): Replace bfd_get_size
check with bfd_section_size_insane. Call free_debug_section
after printing error messages. Set section->start NULL when
freeing.
diff --git a/binutils/objdump.c b/binutils/objdump.c
index 5acaa54929d..3d70df470f2 100644
--- a/binutils/objdump.c
+++ b/binutils/objdump.c
@@ -4286,6 +4286,7 @@ load_specific_debug_section (enum dwarf_section_display_enum debug,
if (streq (section->filename, bfd_get_filename (abfd)))
return true;
free (section->start);
+ section->start = NULL;
}
section->filename = bfd_get_filename (abfd);
@@ -4297,13 +4298,12 @@ load_specific_debug_section (enum dwarf_section_display_enum debug,
alloced = amt = section->size + 1;
if (alloced != amt
|| alloced == 0
- || (bfd_get_size (abfd) != 0 && alloced >= bfd_get_size (abfd)))
+ || bfd_section_size_insane (abfd, sec))
{
- section->start = NULL;
- free_debug_section (debug);
printf (_("\nSection '%s' has an invalid size: %#" PRIx64 ".\n"),
sanitize_string (section->name),
section->size);
+ free_debug_section (debug);
return false;
}
@@ -4345,9 +4345,9 @@ load_specific_debug_section (enum dwarf_section_display_enum debug,
if (!ret)
{
- free_debug_section (debug);
printf (_("\nCan't get contents for section '%s'.\n"),
sanitize_string (section->name));
+ free_debug_section (debug);
return false;
}
--
Alan Modra
next reply other threads:[~2024-05-02 11:07 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-02 11:07 Alan Modra [this message]
2024-05-10 13:11 ` 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=ZjNz7wGwHoOSfCJV@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).