hash.py: observe endianness when reading hashes (#338)
authorAndreas Ziegler <andreas.ziegler@fau.de>
Mon, 26 Oct 2020 13:07:42 +0000 (14:07 +0100)
committerGitHub <noreply@github.com>
Mon, 26 Oct 2020 13:07:42 +0000 (06:07 -0700)
commitd6b2913ba0272c0be74670c9da5ded462859e030
tree7793a54e836ee3b6b52982d2fe550a3e529dea9f
parent9704150f1f5cf8219f85d4bd5b23deac445d448f
hash.py: observe endianness when reading hashes (#338)

Reading the hashes from a GNUHashTable didn't properly use
the endianness of the underlying ELF file, so looking up
hashes would fail if the byte order of the analyzed file
did not match the native byte order of the current machine.

The test file consists of two functions:

int callee(){
    return 42;
}

int caller(){
    return callee();
}

and was compiled using `aarch64_be-linux-gcc` (version 8.3
on an x86_64 host) with the `-mbig-endian` and `-shared`
command line flags.
elftools/elf/hash.py
test/test_hash.py
test/testfiles_for_unittests/aarch64_be_gnu_hash.so.elf [new file with mode: 0755]