Bug 71835 - Defect PDF forces pdftoppm into an endless loop when reconstruct XRef (under windows only)
Summary: Defect PDF forces pdftoppm into an endless loop when reconstruct XRef (under ...
Status: RESOLVED FIXED
Alias: None
Product: poppler
Classification: Unclassified
Component: general (show other bugs)
Version: unspecified
Hardware: Other Windows (All)
: medium normal
Assignee: poppler-bugs
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-11-20 14:21 UTC by Thomas Freitag
Modified: 2013-11-21 22:54 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments
the defect PDF (124.64 KB, application/pdf)
2013-11-20 14:21 UTC, Thomas Freitag
Details
Patch for the problem (465 bytes, patch)
2013-11-20 14:32 UTC, Thomas Freitag
Details | Splinter Review
Alternate patch for this problem (354 bytes, patch)
2013-11-21 08:31 UTC, Thomas Freitag
Details | Splinter Review

Description Thomas Freitag 2013-11-20 14:21:21 UTC
Created attachment 89529 [details]
the defect PDF

The attached PDF forces pdftoppm to run into an endless loop when trying to reconstruct XRef table. Reason for it is the windows version of GooFile::read which returns -1 when trying to read after EOF, but the calling FileStream::fillBuf() doesn't check for -1.
Comment 1 Thomas Freitag 2013-11-20 14:32:31 UTC
Created attachment 89532 [details] [review]
Patch for the problem

This patch solves the problem, GooFile::read now returns 0 bytes read and causes FileStream::fillBuf() to detect the EOF.
Comment 2 Albert Astals Cid 2013-11-20 19:00:40 UTC
would it be better to check the return value? Reading the doc of pread (what we use in posix) it can return -1 too it seems, so it'd break too, no?

Or maybe also change the GooFile::read to make sure it never returns -1?

What do you prefer?
Comment 3 Thomas Freitag 2013-11-21 08:31:38 UTC
Created attachment 89568 [details] [review]
Alternate patch for this problem

I would prefer to check for "-1". This was already my first solution, but because this PDF doesn't make problems under Unix, I changed my first solution without examining the Unix solution.
But since pread can return "-1" too, I think this patch is the more general solution.
Comment 4 Albert Astals Cid 2013-11-21 22:54:49 UTC
commited!


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.