]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
asan: NULL dereference in _bfd_mips_final_write_processing
authorAlan Modra <amodra@gmail.com>
Wed, 7 Feb 2024 01:59:12 +0000 (12:29 +1030)
committerAlan Modra <amodra@gmail.com>
Wed, 7 Feb 2024 10:59:07 +0000 (21:29 +1030)
commitc33ea119b1a5cca79f9efc0a6d5603667954358d
treea47ce94882f1143149f85c94b916710cf0b1823a
parent3ef23ee92631014b6e72e63aa0d6ecc467392546
asan: NULL dereference in _bfd_mips_final_write_processing

Fuzzed object files can easily have unexpected section names.  We
don't want to segfault on objcopy of any file accepted by the mips
object_p functions.  For objcopy, an assertion that "sec" is non-NULL
followed by deferencing "sec" is wrong.  So too is asserting that the
section name string starts with a particular prefix, and then blithely
accessing past the assumed prefix.

* elfxx-mips.c (_bfd_mips_final_write_processing): Replace
assertions with conditionals.  Don't bother testing for name
non-NULL.
bfd/elfxx-mips.c