<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </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 --- - COFFObjectFile::import_directories() range iterates out of range."
   href="https://llvm.org/bugs/show_bug.cgi?id=28302">28302</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>COFFObjectFile::import_directories() range iterates out of range.
          </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>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Object
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>xbandz00@stud.fit.vutbr.cz
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=16634" name="attach_16634" title="Sample binary built by mingw for demonstration (x86 Portable Executable).">attachment 16634</a> <a href="attachment.cgi?id=16634&action=edit" title="Sample binary built by mingw for demonstration (x86 Portable Executable).">[details]</a></span>
Sample binary built by mingw for demonstration (x86 Portable Executable).

Overview: COFFObjectFile::import_directories() range iterates out of range.
Problem is caused by wrong computation of NumberOfImportDirectory which is
based on import table size. This is wrong, because some compilers can add
additional information to import table which increases its size. Iteration
should end, when empty structure is found instead.

To reproduce the bug, use import_directories() or import_directory_iterator
with binary, that adds additional info to import table (usually mingw compiled
binaries,one included in attachment).

Actual results: printing wrong information, segfault in some cases (depends on
what you do with the iterator after it goes out of range).

Expected results: no crash, iteration stops at empty import directory
structure.

Build Date & Platform: 6/24/2016 on Ubuntu 14.04 (x86-64).</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>