[llvm-bugs] [Bug 40807] New: Don't abort printing of dynamic table if string reference is invalid
via llvm-bugs
llvm-bugs at lists.llvm.org
Thu Feb 21 09:07:44 PST 2019
https://bugs.llvm.org/show_bug.cgi?id=40807
Bug ID: 40807
Summary: Don't abort printing of dynamic table if string
reference is invalid
Product: tools
Version: trunk
Hardware: PC
OS: Windows NT
Status: NEW
Severity: enhancement
Priority: P
Component: llvm-readobj
Assignee: unassignedbugs at nondot.org
Reporter: jh7370.2008 at my.bristol.ac.uk
CC: jh7370.2008 at my.bristol.ac.uk, llvm-bugs at lists.llvm.org
llvm-readelf, like GNU readelf, attempts to load strings from the dynamic
string table if a dyanmic tag is encountered which means an offset into that
table (e.g. DT_NEEDED), in order to print meaningful interpretation. However,
unlike GNU readelf, if that value is bogus, either because no DT_STRTAB tag
exists, or the offset is greater than DT_STRSZ, then both llvm-readobj and
llvm-readelf print an error mid-table, and stop printing the table, unlike GNU
readelf, which simply prints the hex value instead and then continues.
llvm-readelf:
DynamicSection [ (5 entries)
Tag Type Name/Value
0x0000000000000005 STRTAB 0x1000
0x000000000000000a STRSZ 3 (bytes)
0x0000000000000001 NEEDED
Error reading file: Invalid dynamic string table reference.
GNU readelf:
Dynamic section at offset 0x1003 contains 5 entries:
Tag Type Name/Value
0x0000000000000005 (STRTAB) 0x1000
0x000000000000000a (STRSZ) 3 (bytes)
0x0000000000000001 (NEEDED) 0x42
0x0000000000000015 (DEBUG) 0x0
0x0000000000000000 (NULL) 0x0
I think we can do better both than our current implementation, and than GNU's
behaviour, by printing the whole table, but indicating in the table where the
offset is an invalid offset, e.g:
DynamicSection [ (5 entries)
Tag Type Name/Value
0x0000000000000005 STRTAB 0x1000
0x000000000000000a STRSZ 3 (bytes)
0x0000000000000001 NEEDED Invalid Offset<0x42>
0x0000000000000015 DEBUG 0x0
0x0000000000000000 NULL 0x0
This will aid in debugging issues in the dynamic table.
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20190221/1e3f2978/attachment-0001.html>
More information about the llvm-bugs
mailing list