Bug 21013 - objdump memory exhausted on several 8k demos
Summary: objdump memory exhausted on several 8k demos
Alias: None
Product: binutils
Classification: Unclassified
Component: binutils (show other bugs)
Version: 2.27
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
Depends on:
Reported: 2016-12-31 20:07 UTC by Aaron Paden
Modified: 2017-01-09 09:30 UTC (History)
1 user (show)

See Also:
Last reconfirmed: 2017-01-04 00:00:00

Proposed patch (363 bytes, patch)
2017-01-04 11:12 UTC, Nick Clifton
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Aaron Paden 2016-12-31 20:07:22 UTC
When using objdump to examine several of the executables found here:

objdump reports exhausted memory when trying to read the symbol table. Note that these executables are certainly going to be using some crazy compression techniques to keep themselves within 8 kilobytes.
Comment 1 Nick Clifton 2017-01-04 11:12:29 UTC
Created attachment 9738 [details]
Proposed patch

Hi Aaron,

  Please could you try out this patch.  It only adds an extra error message,
  explaining why space could not be found to allocate the symbol table.  It
  does not make any attempt to allow objdump to continue working after detecting
  the error.  I felt that doing so would likely add more bugs to objdump, 
  which would be bad.

  I only tested one file from the repository you indicated, so there may be
  others that cause objdump to run out of memory in other ways.  If you find
  any like this, please feel free to update this bug report with their names
  and I will investigate further.

Comment 2 Aaron Paden 2017-01-08 04:32:27 UTC
Huh, every exe I've tried said it failed because there were roughly 18.4 quintillion symbols. That... definitely doesn't seem right. :P
Comment 3 cvs-commit@gcc.gnu.org 2017-01-09 09:29:07 UTC
The master branch has been updated by Nick Clifton <nickc@sourceware.org>:


commit 98f02962fefbacf1b805e93fb7bddeb58ec6ff70
Author: Nick Clifton <nickc@redhat.com>
Date:   Mon Jan 9 09:27:46 2017 +0000

    Improve objdump's behaviour when it encounters a corrupt binary with an excessively large symbol table.
    	PR binutils/21013
    	* coffgen.c (_bfd_coff_get_external_symbols): Generate an error
    	message if there are too many symbols to load.
Comment 4 Nick Clifton 2017-01-09 09:30:45 UTC
Yeah - whoever created those binaries is doing some funky things with the COFF/PE headers.  Anyway I have now checked the patch into the sources.