]> git.ipfire.org Git - thirdparty/elfutils.git/commit
libdwfl: Skip segment that starts past contents_size in elf-from-memory
authorSayed Kaif <skaif@digiscrypt.com>
Wed, 17 Jun 2026 10:31:45 +0000 (16:01 +0530)
committerMark Wielaard <mark@klomp.org>
Fri, 19 Jun 2026 12:28:39 +0000 (14:28 +0200)
commit2ee961badecda2e4cc49aa582005e01dffe31d3b
treef55c7700a52920757f0148d34aed1c7433a00f1f
parenta532f8dc338c26cc436bb7ea265c306aa21dfd37
libdwfl: Skip segment that starts past contents_size in elf-from-memory

When rebuilding an ELF from process memory, segments_end used the last
PT_LOAD segment's end rather than the largest, so a later smaller
segment could shrink contents_size below an earlier segment's start,
underflowing end - start into a huge length and overflowing the heap
buffer. Skip any segment that starts past contents_size, matching the
guard already used in dwfl_segment_report_module.

* libdwfl/elf-from-memory.c (elf_from_remote_memory): Skip
out-of-range segment.

Signed-off-by: Sayed Kaif <skaif@digiscrypt.com>
libdwfl/elf-from-memory.c