public inbox for binutils-cvs@sourceware.org
 help / color / mirror / Atom feed
* [binutils-gdb] objdump: file name table entry count check
@ 2023-08-22  2:23 Alan Modra
  0 siblings, 0 replies; only message in thread
From: Alan Modra @ 2023-08-22  2:23 UTC (permalink / raw)
  To: bfd-cvs

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=8032f75b2994816e87e9d2ab7c46ad86601c999b

commit 8032f75b2994816e87e9d2ab7c46ad86601c999b
Author: Alan Modra <amodra@gmail.com>
Date:   Tue Aug 22 11:41:37 2023 +0930

    objdump: file name table entry count check
    
    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:
---
 binutils/dwarf.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

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;
     }

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-08-22  2:23 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-22  2:23 [binutils-gdb] objdump: file name table entry count check Alan Modra

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