Summary: | Fix handling of UTF16-LE annotations | ||
---|---|---|---|
Product: | poppler | Reporter: | Christophe Fergeau <teuf> |
Component: | general | Assignee: | poppler-bugs <poppler-bugs> |
Status: | RESOLVED MOVED | QA Contact: | |
Severity: | normal | ||
Priority: | medium | CC: | teuf |
Version: | unspecified | ||
Hardware: | Other | ||
OS: | All | ||
Whiteboard: | |||
i915 platform: | i915 features: | ||
Attachments: |
Test case
Proposed patches |
Created attachment 134539 [details] [review] Proposed patches -1 the spec (at least 1.7, don't have the ISO one at hand right now) specifically mentions UTF-16BE Your test case also displays "wrong" here in the old Adobe Reader 9.5.5 for Linux (haven't tried the newer windows versions). Will try the newer windows versions later and read the new ISO spec but for now it seems you should report a bug to Apple. I looked into ISO 32000-1 and it's the same, only UTF-16BE is allowed. I saw a draft of ISO 32000-2 (a.k.a. PDF 2.0) and also only UTF-16BE is allowed. (In reply to Albert Astals Cid from comment #2) > Your test case also displays "wrong" here in the old Adobe Reader 9.5.5 for > Linux (haven't tried the newer windows versions). > > Will try the newer windows versions later and read the new ISO spec but for > now it seems you should report a bug to Apple. I'll try to take a closer look at the file content/the spec/..., but latest Adobe Reader on Windows (Adobe Acrobat Reader DC 2017.012.20093) displays the annotation (same result as with my patch). So yes, it seems there's broken generators out there and Adobe shows them correctly so we should probably do the same. About your patches I don't like that hasBigEndianBOM is just hasUnicodeMarker with a different name, don't do that. -- GitLab Migration Automatic Message -- This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/poppler/poppler/issues/558. |
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.
Created attachment 134538 [details] Test case The 'unicode' annotation in the attached test case does not render properly. I added it through the default mail application on my iOS11 iphone. I trade that down to _poppler_goo_string_to_utf8() which assumes UTF16 strings will always be big endian, while in my test file, a little endian UTF16 string is used. I've fixed this by adding 2 new methods to GooString (hasBigEndianBOM() hasLittleEndianBOM()), but all users of GooString::hasUnicodeMarker() should probably be audited and handle both types of UTF16 strings unless the pdf specs mandates big endian strings. Since I'm not familiar at all with the PDF format, I haven't tried to address this yet.