Bug 96426

Summary: detail::ustring_to_unicode_GooString() shouldn't treat Unicode-encoded string as a C-string
Product: poppler Reporter: Jakub Alba <jakubalba>
Component: cpp frontendAssignee: poppler-bugs <poppler-bugs>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: medium CC: jakubalba
Version: unspecified   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments: cpp: pass len to GooString constructor in detail::ustring_to_unicode_GooString()

Description Jakub Alba 2016-06-07 14:54:10 UTC
Right now detail::ustring_to_unicode_GooString() passes Unicode-encoded string to GooString constructor as a C-string. When I was testing my cpp patch for Bug 36653, I discovered that it causes poppler to save an invalid (metadata object saved after trailer dict) document after modifying metadata. Thus detail::ustring_to_unicode_GooString() should pass len to GooString constructor.
Comment 1 Jakub Alba 2016-06-07 14:57:37 UTC
Created attachment 124388 [details] [review]
cpp: pass len to GooString constructor in detail::ustring_to_unicode_GooString()
Comment 2 Jakub Alba 2016-06-10 20:32:52 UTC
Ok, this is weird. The metadata is still doubled. But poppler reads it as it should. Sorry for not checking it previously.
Comment 3 Jakub Alba 2016-06-10 22:04:50 UTC
Ok, so here's the thing. The thing I wrote about seems to be an unrelated bug.
This patch should still be applied, because otherwise there will be encoding-related problems in the cpp frontend.

The doubling of trailer dict (and metadata when modified) is a problem located in saveIncrementalUpdate(). I'm going to investigate it further and perhaps eventually file another bug about it, but for today I'm going to sleep.

Cheers.
Comment 4 Albert Astals Cid 2016-07-12 21:03:28 UTC
Pushed

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.