Summary: | Corrupted linearization hint table causes massive memory usage and several minute delay | ||
---|---|---|---|
Product: | poppler | Reporter: | jmmorlan |
Component: | general | Assignee: | poppler-bugs <poppler-bugs> |
Status: | RESOLVED FIXED | QA Contact: | |
Severity: | normal | ||
Priority: | medium | ||
Version: | unspecified | ||
Hardware: | All | ||
OS: | All | ||
Whiteboard: | |||
i915 platform: | i915 features: | ||
Attachments: |
Example broken PDF file
Hints.cc patch |
Description
jmmorlan
2016-04-14 23:31:23 UTC
The PDFs were produced by "Aspose.Pdf for .NET 8.9.0", a library which is apparently quite widely used. Created attachment 122979 [details]
Example broken PDF file
you seem to know what you're talking about, maybe you can produce a patch? Created attachment 125492 [details] [review] Hints.cc patch I really don't know much about linearization, but here's a patch to try to fix a couple of problems that stand out: 1. If nBitsNumObjects or nBitsDiffGroupLength are greater than 32, bail out early 2. Improve readBits efficiency (replace recursion with iteration; fix EOF detection to work on any bit, not just those where n is equal to 1 modulo 32) Where in the spec does it say that those values have to be smaller than 33? Right before the table of fields in the Page Offset Hint Table header, there's a note: "All the items in Table F.3 that specify a number of bits needed, such as item 3, have values in the range 0 through 32. Although that range requires only 6 bits, 16-bit numbers shall be used." It doesn't explicitly say this about the Shared Object Hint Table header (described in Table F.5), but there's no indication that it's different, nor can I think of any reason for it to be. Pushed the first part, the second part didn't apply (and was unrealted anyway). |
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.