Summary: | Error-prone eexec stream in PDF | ||
---|---|---|---|
Product: | cairo | Reporter: | Alex Cherepanov <alexcher> |
Component: | pdf backend | Assignee: | Kristian Høgsberg <krh> |
Status: | RESOLVED FIXED | QA Contact: | cairo-bugs mailing list <cairo-bugs> |
Severity: | minor | ||
Priority: | medium | CC: | alexcher |
Version: | 1.4.10 | ||
Hardware: | All | ||
OS: | All | ||
Whiteboard: | |||
i915 platform: | i915 features: | ||
Attachments: | foo.pdf - sample file with '\r' after eexec |
Description
Alex Cherepanov
2007-12-15 15:14:54 UTC
Created attachment 13132 [details]
foo.pdf - sample file with '\r' after eexec
eexec encoding has special means to avoid undesirable characters in the 1st position; there's no need to add spaces. I forgot about this feature. (In reply to comment #2) > eexec encoding has special means to avoid undesirable characters in the 1st > position; there's no need to add spaces. I forgot about this feature. So just to check that I understand this problem correctly: The '\r' character is the first ciphertext byte of the Private dictionary. In PDF files where the eexec-encrypted text is embedded in binary some PDF interpreters treat the '\r' as part of the white space between the 'eexec' and the start of the eexec-encrypted text. Is that correct? When cairo subsets Type 1 fonts it just copies (after decrypting then encrypting) all of the original Private dictionary from the start up to "/CharStrings" to the subsetted font before it starts filtering out unused glyphs. I don't have the exact same version of that font to check but unless there is a bug in cairo it appears that the '\r' resulted from the choice of the four random bytes required to be inserted at the Private dictionary in the original font. However section 7.2 of Adobe Type 1 Font Format requires the first four plaintext bytes to be chosen so that the first cipertext byte is not whitespace. Should cairo be checking and if necessary modifying the four random bytes of plaintext to ensure that the first ciphertext byte is not white space? Or is this bug in the font? PDF and PS handle whitespace characters after eexec. At least, Adobe interpreters do and Ghostscript follows the lead. Conversion from PDF to PS may create invalid PS file unless the font is parsed and re-created. I suggest to avoid whitespace characters after eexec. The exact logic (as I understand it) is documented in the comments to eexec operator in Ghostscript sources. Fixed with this commit: http://gitweb.freedesktop.org/?p=cairo;a=commit;h=0dbb5c9f6222660b1083420419d0eaa71c809ac5 |
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.