We have two files that cause PdfSharp to hang while reading it. Both are, unfortunately, confidential client files.
One is actually an uncompressed ZIP file (using the store method) containing two PDFs. Because there is some flexibility in searching for the PDF header and trailer, the ZIP header and trailer are skipped, so the header of the first PDF and the trailer of the second PDF are recognized, and hilarity ensues.
The other is a PDF file with an XRef stream that has a strange xref entry; not sure yet if it is actually corrupt or not, or if there is an additional bug in PdfSharp.
Anyway, in both cases PdfSharp ends up trying to read an object at an incorrect offset in the file, thinks it is a hexadecimal string (which it isn't), and ends up in an infinite loop.
If more detail is needed, I can try to construct a non-confidential PDF exhibiting the problem.
Patch: see attachment.
I also fixed according to the spec (but didn't test) the case when a hexadecimal number is incomplete at the end of a string.
_________________ Gerben Vos Developer
|