<html>
<head>
<base href="https://bugs.llvm.org/">
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - Don't abort printing of dynamic table if string reference is invalid"
href="https://bugs.llvm.org/show_bug.cgi?id=40807">40807</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Don't abort printing of dynamic table if string reference is invalid
</td>
</tr>
<tr>
<th>Product</th>
<td>tools
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Windows NT
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>enhancement
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>llvm-readobj
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>jh7370.2008@my.bristol.ac.uk
</td>
</tr>
<tr>
<th>CC</th>
<td>jh7370.2008@my.bristol.ac.uk, llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>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.</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>