diff options
author | Bo Anderson <mail@boanderson.me> | 2022-10-10 15:17:06 +0100 |
---|---|---|
committer | Jörg Thalheim <joerg@thalheim.io> | 2022-10-26 08:20:56 +0200 |
commit | 15f02b0f7a2721062a89d545d9f3696499f0d8de (patch) | |
tree | d5de6fafd37bc2d436df55db08478e2e58a89619 /tests | |
parent | 0582e4d9c2892fdafef97b67bc09082956dd5e47 (diff) | |
download | patchelf-15f02b0f7a2721062a89d545d9f3696499f0d8de.tar.gz |
Skip empty PT_NOTE sections
Previous versions of patchelf prior to 0.12 could create empty PT_NOTE sections. For backwards compatibility reasons, we should not error on such binaries.
Fixes #400.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/Makefile.am | 5 | ||||
-rwxr-xr-x | tests/empty-note | bin | 0 -> 984 bytes | |||
-rwxr-xr-x | tests/empty-note.sh | 12 |
3 files changed, 15 insertions, 2 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am index 600639d..ba51652 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -42,14 +42,15 @@ src_TESTS = \ phdr-corruption.sh \ replace-needed.sh \ replace-add-needed.sh \ - add-debug-tag.sh + add-debug-tag.sh \ + empty-note.sh build_TESTS = \ $(no_rpath_arch_TESTS) TESTS = $(src_TESTS) $(build_TESTS) -EXTRA_DIST = no-rpath-prebuild $(src_TESTS) no-rpath-prebuild.sh invalid-elf endianness +EXTRA_DIST = no-rpath-prebuild $(src_TESTS) no-rpath-prebuild.sh invalid-elf endianness empty-note TESTS_ENVIRONMENT = PATCHELF_DEBUG=1 diff --git a/tests/empty-note b/tests/empty-note Binary files differnew file mode 100755 index 0000000..d58435e --- /dev/null +++ b/tests/empty-note diff --git a/tests/empty-note.sh b/tests/empty-note.sh new file mode 100755 index 0000000..c127d8c --- /dev/null +++ b/tests/empty-note.sh @@ -0,0 +1,12 @@ +#! /bin/sh -e + +SCRATCH=scratch/$(basename $0 .sh) + +rm -rf ${SCRATCH} +mkdir -p ${SCRATCH} +cp $(dirname $(readlink -f $0))/empty-note ${SCRATCH}/ + +# Running --set-interpreter on this binary should not produce the following +# error: +# patchelf: cannot normalize PT_NOTE segment: non-contiguous SHT_NOTE sections +../src/patchelf --set-interpreter ld-linux-x86-64.so.2 ${SCRATCH}/empty-note |