]> git.ipfire.org Git - thirdparty/elfutils.git/commit
libelf: Optimize elf_strptr.c validate_str by checking last char first
authorMark Wielaard <mark@klomp.org>
Mon, 19 Jul 2021 13:52:51 +0000 (15:52 +0200)
committerMark Wielaard <mark@klomp.org>
Mon, 19 Jul 2021 13:52:51 +0000 (15:52 +0200)
commit0aed4315b2f6c54f4efcf8a8d22e59a36e6eb30d
tree774d0c3a232f303232a76783c7d12ef1aa1c9c87
parent779c57ea864d104bad88455535df9b26336349fd
libelf: Optimize elf_strptr.c validate_str by checking last char first

In most cases the last char of the sectio will be zero. Check that
first before calling memrchr. This is a minor optimization in normal
cases. But it helps asan a lot by removing the memrchr call in most
cases.

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

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