<html>
    <head>
      <base href="https://bugs.freedesktop.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 - NULL pointer dereference in GooString.cc:867"
   href="https://bugs.freedesktop.org/show_bug.cgi?id=101523">101523</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>NULL pointer dereference in GooString.cc:867
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>poppler
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>Other
          </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>medium
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>general
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>poppler-bugs@lists.freedesktop.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>foca@salesforce.com
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=132093" name="attach_132093" title="Proof of concept">attachment 132093</a> <a href="attachment.cgi?id=132093&action=edit" title="Proof of concept">[details]</a></span>
Proof of concept

There is a NULL dereference parsing the attached PoC.pdf.

The NULL dereference happens in GooString.cc:867
863     int GooString::cmp(const char *sA) const {
864       int n1, i, x;
865       const char *p1, *p2;
866     
867       n1 = length;

"this" is NULL so this->n1 at 867 generates the SIGSEGV. The reason this is
null is because the previous function GfxCIDFont::getCodeToGIDMap in
GfxFont.cc:2375 calls a method of a NULL object:

2373      *mapsizep = 0;
2374      if (!ctu) return NULL;
2375      if (getCollection()->cmp("Adobe-Identity") == 0) return NULL;
2376      if (getEmbeddedFontID(&embID)) {


Parsing the PoC.pdf getCollection() returns NULL but the method cmp is called.

The solution should be check for the return value before call cmp:
2375      if (getCollection() == NULL || getCollection()->cmp("Adobe-Identity")
== 0) return NULL;

PoC attached. To reproduce the bug use:
pdftocairo -svg PoC.pdf

This vulnerability has been found by Offensive Research at Salesforce.com:
Alberto Garcia (@algillera), Francisco Oca (@francisco_oca) & Suleman Ali
(@Salbei_)</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>