[Poppler-bugs] [Bug 104961] New: poppler-glib: poppler_document_new_from_data() receives data as UTF-8 string not binary

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Tue Feb 6 06:36:18 UTC 2018


https://bugs.freedesktop.org/show_bug.cgi?id=104961

            Bug ID: 104961
           Summary: poppler-glib: poppler_document_new_from_data()
                    receives data as UTF-8 string not binary
           Product: poppler
           Version: unspecified
          Hardware: Other
                OS: All
            Status: NEW
          Severity: normal
          Priority: medium
         Component: glib frontend
          Assignee: poppler-bugs at lists.freedesktop.org
          Reporter: okimoto at clear-code.com

Created attachment 137181
  --> https://bugs.freedesktop.org/attachment.cgi?id=137181&action=edit
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.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/poppler-bugs/attachments/20180206/756ff5d4/attachment.html>


More information about the Poppler-bugs mailing list