<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 truncate the DW_TAG value when parsing abbrevs"
   href="https://bugs.llvm.org/show_bug.cgi?id=44258">44258</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Don't truncate the DW_TAG value when parsing abbrevs
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libraries
          </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>DebugInfo
          </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>jdevlieghere@apple.com, keith.walker@arm.com, llvm-bugs@lists.llvm.org, paul_robinson@playstation.sony.com
          </td>
        </tr></table>
      <p>
        <div>
        <pre>LLVM's DWARF.h restricts the DW_TAG/AT/FORM enums to uint16_t size. It is true
that all known values fit in this field, including any user-defined ones in the
designated ranges. However, in the DWARF spec, these values are recorded in
.debug_abbrev declarations as ULEB128, which has no technical upper-limit.

This becomes a problem when parsing .debug_abbrev sections with unknown tag
values that are greater than 16-bits, e.g. "0x10000". In
DWARFAbbreviationDeclaration::extract, we static cast the result of the ULEB
parsing of the tag value to a dwarf::Tag, resulting in the value being
truncated. This can either end up in a value of 0 for the aforementioned value
of 0x10000, which is interpreted as an end of abbrevs block, or another
arbitrary value. The former results in an incorrect parsing of the rest of the
section, whilst the latter will result in potentially incorrect interpretations
of the tag (e.g. 0x10001 causes llvm-dwarfdump to print the tag as
"DW_TAG_unknown_0x4000" instead of the more correct "DW_TAG_unknown_0x10001").</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>