Bug 104961 - poppler-glib: poppler_document_new_from_data() receives data as UTF-8 string not binary
Summary: poppler-glib: poppler_document_new_from_data() receives data as UTF-8 string ...
Status: RESOLVED MOVED
Alias: None
Product: poppler
Classification: Unclassified
Component: glib frontend (show other bugs)
Version: unspecified
Hardware: Other All
: medium normal
Assignee: poppler-bugs
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-02-06 06:36 UTC by okimoto
Modified: 2018-08-21 10:57 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments
Add type annotation to poppler_document_new_from_data() (560 bytes, patch)
2018-02-06 06:36 UTC, okimoto
Details | Splinter Review

Description okimoto 2018-02-06 06:36:18 UTC
Created attachment 137181 [details] [review]
Add type annotation to poppler_document_new_from_data()

In Poppler-0.18.gir poppler_document_new_from_data() is defined as following:

      <constructor name="new_from_data"
                   c:identifier="poppler_document_new_from_data"
                   throws="1">
        <doc xml:space="preserve">Creates a new #PopplerDocument.  If %NULL is returned, then @error will be
set. Possible errors include those in the #POPPLER_ERROR and #G_FILE_ERROR
domains.</doc>
        <return-value transfer-ownership="full">
          <doc xml:space="preserve">A newly created #PopplerDocument, or %NULL</doc>
          <type name="Document" c:type="PopplerDocument*"/>
        </return-value>
        <parameters>
          <parameter name="data" transfer-ownership="none">
            <doc xml:space="preserve">the pdf data contained in a char array</doc>
            <type name="utf8" c:type="char*"/>
          </parameter>
          <parameter name="length" transfer-ownership="none">
            <doc xml:space="preserve">the length of #data</doc>
            <type name="gint" c:type="int"/>
          </parameter>
          <parameter name="password"
                     transfer-ownership="none"
                     nullable="1"
                     allow-none="1">
            <doc xml:space="preserve">password to unlock the file with, or %NULL</doc>
            <type name="utf8" c:type="const char*"/>
          </parameter>
        </parameters>
      </constructor>


This definition validates data as UTF-8 string when read a PDF data using poppler_document_new_from_data() via gobject-introspection.
In general, PDF data is not UTF-8 string. So we should treat parameter data as binary.

I wrote tiny patch and confirm that the poppler_document_new_from_data() definition is updated after applied this patch.
However, I'm not familiar with gobject-introspection in honest.
Comment 1 GitLab Migration User 2018-08-21 10:57:43 UTC
-- 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/448.


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.