]> git.ipfire.org Git - thirdparty/elfutils.git/commit
libelf: Check ELF parent size can contain ar member
authorMark Wielaard <mark@klomp.org>
Sat, 6 Sep 2025 10:39:15 +0000 (12:39 +0200)
committerMark Wielaard <mark@klomp.org>
Sat, 6 Sep 2025 21:55:55 +0000 (23:55 +0200)
commit685e4ad915f0c594696d9fdae9ab4074d250392d
treef7127e11d871ede1803eba849626754cb560ef15
parentdf9bd6bdc332243d1e3072844e227cac9ec5d025
libelf: Check ELF parent size can contain ar member

Don't trust the ar header offset and size. When creating an Elf
descriptor for an ar member check the offset isn't past the end of the
containing Elf and don't use/set the member maximum_size larger than
the remaining size of the parent.

* libelf/elf_begin.c (dup_elf): Only call read_file if the
        offset isn't past the end and with a maximum_size not too large.

Signed-off-by: Mark Wielaard <mark@klomp.org>
libelf/elf_begin.c