aboutsummaryrefslogtreecommitdiff
path: root/depcomp
diff options
context:
space:
mode:
authorFelix Willgerodt <felix.willgerodt@intel.com>2023-11-09 14:08:10 +0100
committerFelix Willgerodt <felix.willgerodt@intel.com>2023-11-21 08:56:25 +0100
commit4be3bbe89f67c360098373d4850565a472c36f9d (patch)
tree9c3af5df924396853a927b8d3058b10d40c270b1 /depcomp
parent5a6c54baa43e310447f2070e51a5ec395f188905 (diff)
downloadgdb-4be3bbe89f67c360098373d4850565a472c36f9d.zip
gdb-4be3bbe89f67c360098373d4850565a472c36f9d.tar.gz
gdb-4be3bbe89f67c360098373d4850565a472c36f9d.tar.bz2
gdb: Fix segfault with a big .dynamic section size
Consider a binary with an erroneous size of the .dynamic section: $ readelf -S a.out ... [24] .dynamic DYNAMIC 0000000000004c20 00003c20 000000fffffffa40 0000000000000010 WA 7 0 8 ... This binary causes a segfault in GDB. GDB is trying to write the .dynamic section into memory allocated on the stack with alloca(). However, the allocation silently fails and the subsequent access to the memory is causing the segfault. (On my node at least.) Stack allocation is a bad idea for something of variable size that GDB has no control over. So I changed the code to heap allocation. In addition, I changed the type of sect_size to the type that bfd actually returns. There should be no user visible change after this. Approved-By: Tom Tromey <tom@tromey.com>
Diffstat (limited to 'depcomp')
0 files changed, 0 insertions, 0 deletions