<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 - Uninitialized memory read in GfxState.cc:4041"
   href="https://bugs.freedesktop.org/show_bug.cgi?id=101502">101502</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Uninitialized memory read in GfxState.cc:4041
          </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=132067" name="attach_132067" title="Proof of concept">attachment 132067</a> <a href="attachment.cgi?id=132067&action=edit" title="Proof of concept">[details]</a></span>
Proof of concept

There is a uninitialized memory read that leads to a Denial of Service.

The PoC crashes in the following line:

Program received signal SIGSEGV, Segmentation fault.
0x0000000000436480 in Function::getOutputSize (this=0x2f502f2052203020) at
Function.h:77
77        int getOutputSize() { return n; }

Just before call the function, GfxUnivariateShading::getColor at
GfxState.cc:4041
4041      nComps = nFuncs * funcs[0]->getOutputSize();

The variable funcs is an array of nFuncs elements. But in the PoC the number of
elements, nFuncs is 0, but still the code is accessing the first element,
funcs[0], using uninitialized memory data. The program is expecting to get a
pointer with funcs[0] and it crashes when it dereferences an invalid pointer.

The fix would be to check if there is at least one element before accessing the
first one:

4041    if (nFuncs >= 1)
4042        nComps = nFuncs * funcs[0]->getOutputSize();

PoC is attached.

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>