summaryrefslogtreecommitdiffstats
path: root/tests/Makefile.am
diff options
context:
space:
mode:
authorJohn Ogness <[email protected]>2016-06-23 16:03:58 +0200
committerMark Wielaard <[email protected]>2016-06-28 20:19:24 +0200
commit96e140f6687922606657a76f185a73cf47908ef2 (patch)
tree21b2be7ae43403b06511775c0ab5cfa4937af581 /tests/Makefile.am
parent9a36c9226c4a237208a7735f0e6a6fd1eefb60ab (diff)
libelf: find 1st section instead of assuming
When getting section headers it is assumed that the first section is on the first section list. However, it is possible that the first section list only contains the zeroth section, in which case either illegal memory access occurs or elf_nextscn() erroneously returns NULL. With this patch, checks are added to avoid the illegal memory access and (if available) the second section list is looked at to find the first section. A new test emptyfile is added that tests adding a section to and "empty" ELF file 32/64 class with ELF_C_RDWR[_MMAP]. Signed-off-by: John Ogness <[email protected]> Signed-off-by: Mark Wielaard <[email protected]>
Diffstat (limited to 'tests/Makefile.am')
-rw-r--r--tests/Makefile.am6
1 files changed, 4 insertions, 2 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 274356fb..9c22c4d7 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -53,7 +53,7 @@ check_PROGRAMS = arextract arsymtest newfile saridx scnnames sectiondump \
buildid deleted deleted-lib.so aggregate_size vdsosyms \
getsrc_die strptr newdata elfstrtab dwfl-proc-attach \
elfshphehdr elfstrmerge dwelfgnucompressed elfgetchdr \
- elfgetzdata elfputzdata zstrptr
+ elfgetzdata elfputzdata zstrptr emptyfile
asm_TESTS = asm-tst1 asm-tst2 asm-tst3 asm-tst4 asm-tst5 \
asm-tst6 asm-tst7 asm-tst8 asm-tst9
@@ -126,7 +126,8 @@ TESTS = run-arextract.sh run-arsymtest.sh newfile test-nlist \
run-elfgetchdr.sh \
run-elfgetzdata.sh run-elfputzdata.sh run-zstrptr.sh \
run-compress-test.sh \
- run-readelf-zdebug.sh run-readelf-zdebug-rel.sh
+ run-readelf-zdebug.sh run-readelf-zdebug-rel.sh \
+ emptyfile
if !BIARCH
export ELFUTILS_DISABLE_BIARCH = 1
@@ -481,6 +482,7 @@ elfgetchdr_LDADD = $(libelf) $(libdw)
elfgetzdata_LDADD = $(libelf)
elfputzdata_LDADD = $(libelf)
zstrptr_LDADD = $(libelf)
+emptyfile_LDADD = $(libelf)
# We want to test the libelf header against the system elf.h header.
# Don't include any -I CPPFLAGS.