diff options
author | Alan Modra <amodra@gmail.com> | 2020-03-11 13:50:35 +1030 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2020-03-11 15:01:15 +1030 |
commit | 9cc89dc0acc140cb27e21d2597af42d36444673b (patch) | |
tree | 6fc9a4fe2c099ba2fa0714c2b7933cf827833ae6 /libctf | |
parent | 1db6f990303ab6c45909f8e133641ef6c24a04d2 (diff) | |
download | gdb-9cc89dc0acc140cb27e21d2597af42d36444673b.zip gdb-9cc89dc0acc140cb27e21d2597af42d36444673b.tar.gz gdb-9cc89dc0acc140cb27e21d2597af42d36444673b.tar.bz2 |
PR25651, objcopy SIGSEGV in copy_object
With the right set of options, the second block of code dealing with
padding can see a different section count. So don't use the new count.
Since I was editing those lines, I've also changed the code allocating
arrays a little.
array = malloc (n * sizeof (*array));
for an array of ints is just better than
array = malloc (n * sizeof (int));
It's easier to write correctly in the first place and more robust
against code changes that might modify the array element type.
PR 25651
* objcopy.c (copy_object): Test "gaps" not gap_fill_set or
pad_to_set on second block of code dealing with padding.
Replace "c" with "num_sec" and don't recalculate number of
sections on second block. Size arrays using sizeof (element)
rather than sizeof (element type).
Diffstat (limited to 'libctf')
0 files changed, 0 insertions, 0 deletions