<html>
    <head>
      <base href="https://bugs.freedesktop.org/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Priority</th>
          <td>medium
          </td>
        </tr>

        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - pdfinfo hangs when a corrupt file is piped in via stdin"
   href="https://bugs.freedesktop.org/show_bug.cgi?id=64967">64967</a>
          </td>
        </tr>

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

        <tr>
          <th>Summary</th>
          <td>pdfinfo hangs when a corrupt file is piped in via stdin
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>major
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Mac OS X (All)
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>nathan@storydesk.com
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>x86-64 (AMD64)
          </td>
        </tr>

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

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

        <tr>
          <th>Component</th>
          <td>utils
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>poppler
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=79774" name="attach_79774" title="A bad PDF file">attachment 79774</a> <a href="attachment.cgi?id=79774&action=edit" title="A bad PDF file">[details]</a></span>
A bad PDF file

When pdfinfo receives a corrupt file that is piped in via stdin it hangs with
100% CPU usage.

Example Usage:

cat damaged.pdf | pdfinfo -

Output:

Syntax Warning: May not be a PDF file (continuing anyway)

Expected outcome:

The program should terminate after determining that the file is corrupt

Actual outcome:

After outputting the one error message it never terminates and sits there using
100% of the CPU.

It is worth noting that when pdfinfo is invoked with the exact same file via:

pdfinfo damaged.pdf

instead of piping the corrupt PDF in via stdin then this problem does not
happen and the output is:

Syntax Warning: May not be a PDF file (continuing anyway)
Syntax Error: Couldn't find trailer dictionary
Syntax Error: Couldn't read xref table

Then the process terminates as expected.

I have attached the bad file that I am using to test with and recreate this
issue.</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>