Bug 64967

Summary: pdfinfo hangs when a corrupt file is piped in via stdin
Product: poppler Reporter: Nathan Peck <nathan>
Component: utilsAssignee: poppler-bugs <poppler-bugs>
Status: RESOLVED FIXED QA Contact:
Severity: major    
Priority: medium    
Version: unspecified   
Hardware: x86-64 (AMD64)   
OS: Mac OS X (All)   
Whiteboard:
i915 platform: i915 features:
Attachments: A bad PDF file

Description Nathan Peck 2013-05-24 21:41:52 UTC
Created attachment 79774 [details]
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.
Comment 1 Albert Astals Cid 2013-05-26 22:21:01 UTC
Will be fixed in poppler 0.22.5. Thanks for the report

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.