[PATCH] D77147: [llvm-readobj] - Do not crash when SHT_HASH table is broken.

James Henderson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 1 00:30:57 PDT 2020


jhenderson added inline comments.


================
Comment at: llvm/test/tools/llvm-readobj/ELF/hash-histogram.test:116
+
+## Each SHT_HASH section starts from two 32-bit fields: nbucket and nchain.
+## Check we report an error when a DT_HASH value points to a data that has size less than 8 bytes.
----------------
MaskRay wrote:
> starts with
(Also applies in the other tests)


================
Comment at: llvm/test/tools/llvm-readobj/ELF/hash-histogram.test:117
+## Each SHT_HASH section starts from two 32-bit fields: nbucket and nchain.
+## Check we report an error when a DT_HASH value points to a data that has size less than 8 bytes.
+
----------------
points to data (also applies in other tests)


================
Comment at: llvm/test/tools/llvm-readobj/ELF/hash-histogram.test:122
+
+# ERR1: warning: '[[FILE]]': the hash table at offset 0x2b1 goes past the EOF (0x2b8){{$}}
+
----------------
I'd spell out "EOF" in error messages (i.e. "goes past the end of the file"). Same goes below.


================
Comment at: llvm/test/tools/llvm-readobj/ELF/hash-histogram.test:152
+
+## Check we report a warning when the hash table goes past the end of file.
+
----------------
end of the file


================
Comment at: llvm/test/tools/llvm-readobj/ELF/hash-symbols.test:387
+
+## Check we report a warning when the hash table goes past the end of file.
+
----------------
end of the file


================
Comment at: llvm/test/tools/llvm-readobj/ELF/hash-symbols.test:408
+# RUN: yaml2obj --docnum=7 %s -o %t7.3.o -DNBUCKET=0x1 -DNCHAIN=0x5d
+# RUN: llvm-readelf --hash-symbols %t7.3.o 2>&1 | FileCheck %s --implicit-check-not="warning:" --check-prefix=NOERR2 -DFILE=%t7.3.o
+# NOERR2:      warning: '[[FILE]]': hash table nchain (93) differs from symbol count derived from SHT_DYNSYM section header (1)
----------------
This line probably wants splitting.


================
Comment at: llvm/test/tools/llvm-readobj/ELF/hash-table.test:163
+# RUN: yaml2obj --docnum=5 %s -o %t5.1.o -DNBUCKET=0x5d -DNCHAIN=0x1
+# RUN: llvm-readelf --hash-table %t5.1.o 2>&1 | FileCheck %s --check-prefix=NOERR1 --implicit-check-not="warning:"
+# RUN: llvm-readobj --hash-table %t5.1.o 2>&1 | FileCheck %s --check-prefix=NOERR1 --implicit-check-not="warning:"
----------------
All these lines probably want splitting.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D77147/new/

https://reviews.llvm.org/D77147





More information about the llvm-commits mailing list