[Poppler-bugs] [Bug 104502] New: I/O errors during checkheader() cause hang
bugzilla-daemon at freedesktop.org
bugzilla-daemon at freedesktop.org
Fri Jan 5 14:57:41 UTC 2018
https://bugs.freedesktop.org/show_bug.cgi?id=104502
Bug ID: 104502
Summary: I/O errors during checkheader() cause hang
Product: poppler
Version: unspecified
Hardware: All
OS: Linux (All)
Status: NEW
Severity: minor
Priority: medium
Component: general
Assignee: poppler-bugs at lists.freedesktop.org
Reporter: btimby at gmail.com
Created attachment 136569
--> https://bugs.freedesktop.org/attachment.cgi?id=136569&action=edit
Check return code of getChar(), abort reading on error.
Hi, I ran into an issue when using pdftotext on files stored on a CIFS mount. A
problem with the CIFS server was causing EIO to be returned for read() calls.
It takes about 1 minute for EIO to be returned, blocking each read() for about
1 minute before it fails.
This caused pdftotext to run for around 16 hours before finally failing. I
tracked this down to PDFDoc::checkHeader(), which attempts to read 1024 chars
using FileStream::getChar() into a buffer. It uses this buffer for file type
detection.
The problem is that it does not check the return code of getChar(). getChar()
returns EOF in response to the EIO, but that EOF is just placed into the
buffer, and another read() is attempted (1024 times) making the process block
in uninterruptible sleep for 16 hours or so.
The fix is to check this return code and stop reading. I am attaching a patch.
--
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/poppler-bugs/attachments/20180105/d3080f97/attachment.html>
More information about the Poppler-bugs
mailing list