Bug 22230 - heap-based buffer overflow in display_debug_macro (dwarf.c)
Summary: heap-based buffer overflow in display_debug_macro (dwarf.c)
Status: RESOLVED FIXED
Alias: None
Product: binutils
Classification: Unclassified
Component: binutils (show other bugs)
Version: 2.30
: P2 normal
Target Milestone: 2.30
Assignee: Alan Modra
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-09-30 09:54 UTC by Agostino Sarubbo
Modified: 2017-10-01 11:13 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Last reconfirmed: 2017-09-30 00:00:00


Attachments
stacktrace.txt (1.19 KB, text/plain)
2017-09-30 09:54 UTC, Agostino Sarubbo
Details
testcase (175.50 KB, application/x-archive)
2017-09-30 09:55 UTC, Agostino Sarubbo
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Agostino Sarubbo 2017-09-30 09:54:13 UTC
Created attachment 10493 [details]
stacktrace.txt

On 2.29.51.20170929:

#objdump -g -D -F -S --file-start-context -l -R -s -W -G -T --special-syms -x $FILE
Comment 1 Agostino Sarubbo 2017-09-30 09:55:51 UTC
Created attachment 10494 [details]
testcase
Comment 2 Sourceware Commits 2017-10-01 02:04:57 UTC
The master branch has been updated by Alan Modra <amodra@sourceware.org>:

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

commit 4f1881b94473f1034f950feb863b464435a8fb5f
Author: Alan Modra <amodra@gmail.com>
Date:   Sun Oct 1 12:07:07 2017 +1030

    PR22230, buffer overflow in display_debug_macro
    
    	PR 22230
    	* objdump.c (load_specific_debug_section): Allocate an extra byte
    	for a terminating NUL.
Comment 3 Alan Modra 2017-10-01 02:20:03 UTC
Fixed
Comment 4 Sourceware Commits 2017-10-01 11:13:10 UTC
The master branch has been updated by Alan Modra <amodra@sourceware.org>:

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

commit bfec0f11eadd7ed3597bc9b550a5595421a4cb31
Author: Alan Modra <amodra@gmail.com>
Date:   Sun Oct 1 21:40:23 2017 +1030

    PR22232, NULL pointer dereference in load_specific_debug_section
    
    	PR 22232
    	PR 22230
    	* objdump.c (load_specific_debug_section): Introduce a temp to
    	stop bfd_get_full_section_contents NULLing out section->start.