]> git.ipfire.org Git - thirdparty/elfutils.git/commit
libelf: Handle elf_strptr on section without any data
authorMark Wielaard <mark@klomp.org>
Wed, 12 Feb 2025 23:02:32 +0000 (00:02 +0100)
committerMark Wielaard <mark@klomp.org>
Fri, 14 Feb 2025 07:55:11 +0000 (08:55 +0100)
commitb16f441cca0a4841050e3215a9f120a6d8aea918
treea3986cd5d1d27a8ac3242843fb09d518fb01cdde
parentfbf1df9ca286de3323ae541973b08449f8d03aba
libelf: Handle elf_strptr on section without any data

In the unlikely situation that elf_strptr was called on a section with
sh_size already set, but that doesn't have any data yet we could crash
trying to verify the string to return.

This could happen for example when a new section was created with
elf_newscn, but no data having been added yet.

* libelf/elf_strptr.c (elf_strptr): Check strscn->rawdata_base
is not NULL.

https://sourceware.org/bugzilla/show_bug.cgi?id=32672

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