From: Alan Modra <amodra@gmail.com>
To: binutils@sourceware.org
Subject: objdump: file name table entry count check
Date: Tue, 22 Aug 2023 11:53:20 +0930 [thread overview]
Message-ID: <ZOQcGOqFn749Uarv@squeak.grove.modra.org> (raw)
Fuzzers have found that objdump -W takes a really long time if
the entry count uleb is ridiculously large, and format attributes
don't consume data (which doesn't make sense for a table of names).
* dwarf.c (display_formatted_table): Sanity check count of
table entries.
diff --git a/binutils/dwarf.c b/binutils/dwarf.c
index 4f695bf2bca..3ebc45ae373 100644
--- a/binutils/dwarf.c
+++ b/binutils/dwarf.c
@@ -4313,10 +4313,10 @@ display_formatted_table (unsigned char *data,
printf (_("\n The %s is empty.\n"), table_name);
return data;
}
- else if (data >= end)
+ else if (data >= end
+ || data_count > (size_t) (end - data))
{
- warn (_("%s: Corrupt entry count - expected %#" PRIx64
- " but none found\n"), table_name, data_count);
+ warn (_("%s: Corrupt entry count %#" PRIx64 "\n"), table_name, data_count);
return data;
}
--
Alan Modra
Australia Development Lab, IBM
reply other threads:[~2023-08-22 2:23 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=ZOQcGOqFn749Uarv@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).