PDFsharp & MigraDoc Foundation

Error when dict contains hexstring or nested dict + patch
Page 1 of 1

Author:  Gerben Vos [ Thu Sep 08, 2016 7:39 pm ]
Post subject:  Error when dict contains hexstring or nested dict + patch

PdfSharp does not do a full parse of dictionaries that occur in content streams, but instead just scans for the next '>' character. This fails if the dictionary contains nested dictionaries (delimited by << >>), or hexadecimal strings (delimited by < >).

Depending on the exact syntax in the content stream, this can result in these error messages:
- The given key was not present in the dictionary. (origami.pdf)
- Unexpected character '0x003e' in content stream. (found in confidential client PDFs only, sorry)
- Array within array... (SmoothShading.pdf)

Resolved by implementing a more thorough scanning of the dictionary. It should really be fixed by doing a proper recursive parse instead of a scan, but that would require more drastic changes to the library.

Patch attached.

SmoothShading.zip [138.05 KiB]
Downloaded 304 times
origami.zip [41.39 KiB]
Downloaded 308 times
pdfsharp-687.zip [827 Bytes]
Downloaded 307 times

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group