public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* PR28543, readelf entered an infinite loop
@ 2021-11-09 22:49 Alan Modra
  0 siblings, 0 replies; only message in thread
From: Alan Modra @ 2021-11-09 22:49 UTC (permalink / raw)
  To: binutils

This little tweak terminates fuzzed binary readelf output a little
quicker.  BTW, it wasn't an infinite loop, just a very long one.

For most fuzzed input that really does result in infinite loops in any
of the binutils, I'm inclined to say that's too bad.  You fed in
stupid input, expect stupid output.  The same goes for out of memory
errors.

	PR 28543
	* dwarf.c (read_and_display_attr_value): Consume a byte when
	form is unrecognized.

diff --git a/binutils/dwarf.c b/binutils/dwarf.c
index d80235fb206..ce54813a076 100644
--- a/binutils/dwarf.c
+++ b/binutils/dwarf.c
@@ -2743,6 +2743,8 @@ read_and_display_attr_value (unsigned long           attribute,
       
     default:
       warn (_("Unrecognized form: 0x%lx\n"), form);
+      /* What to do?  Consume a byte maybe?  */
+      ++data;
       break;
     }
 

-- 
Alan Modra
Australia Development Lab, IBM

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

only message in thread, other threads:[~2021-11-09 22:49 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-09 22:49 PR28543, readelf entered an infinite loop 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).