PR24042, Global-buffer-overflow problem in output_rel_find
authorAlan Modra <amodra@gmail.com>
Mon, 31 Dec 2018 06:36:25 +0000 (17:06 +1030)
committerAlan Modra <amodra@gmail.com>
Mon, 31 Dec 2018 07:26:32 +0000 (17:56 +1030)
commit8fd04a4255376036e85c4e80d430b44ec4b06c64
tree103df2c3136c544b5c65f742573aecab0124c6b2
parent54025d5812ff100f5f0654eb7e1ffd50f2e37f5f
PR24042, Global-buffer-overflow problem in output_rel_find

place_orphan handled ELF SHT_REL/SHT_RELA specially, output_rel_find
didn't.  This mismatch was a bug and also meant it was possible to
craft an object where ld accessed section->name out of bounds.

PR 24042
* emultempl/elf32.em (output_rel_find): Drop "sec" param.  Add
"rela".
(gld${EMULATION_NAME}_place_orphan): Use sh_type to calculate
"rela" param of output_rel_find when ELF.  Tidy uses of elfinput.
ld/ChangeLog
ld/emultempl/elf32.em