<html>
<head>
<base href="https://bugs.freedesktop.org/">
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - Poppler-INFO: Syntax error at position -1: Document stream is empty with poppler_document_new_from_stream()"
href="https://bugs.freedesktop.org/show_bug.cgi?id=104877">104877</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Poppler-INFO: Syntax error at position -1: Document stream is empty with poppler_document_new_from_stream()
</td>
</tr>
<tr>
<th>Product</th>
<td>poppler
</td>
</tr>
<tr>
<th>Version</th>
<td>unspecified
</td>
</tr>
<tr>
<th>Hardware</th>
<td>Other
</td>
</tr>
<tr>
<th>OS</th>
<td>All
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>medium
</td>
</tr>
<tr>
<th>Component</th>
<td>glib frontend
</td>
</tr>
<tr>
<th>Assignee</th>
<td>poppler-bugs@lists.freedesktop.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>kenhys@gmail.com
</td>
</tr></table>
<p>
<div>
<pre>Created <span class=""><a href="attachment.cgi?id=137076" name="attach_137076" title="sample source code which reproduces it">attachment 137076</a> <a href="attachment.cgi?id=137076&action=edit" title="sample source code which reproduces it">[details]</a></span>
sample source code which reproduces it
# Problem
poppler_document_new_from_stream() causes syntax error. In the contrast,
poppler_document_new_from_file() doesn't cause an error even though same pdf
file is used.
Here is the actual reported errors.
+ G_MESSAGES_DEBUG=Poppler ./poppler-glib-document-new
poppler_document_new_from_file()
poppler_document_new_from_stream()
Poppler-INFO: Syntax error at position 22: Illegal character <21> in hex
string
Poppler-INFO: Syntax error at position 23: Illegal character <59> in hex
string
Poppler-INFO: Syntax error at position 24: Illegal character <f3> in hex
string
Poppler-INFO: Syntax error at position 25: Illegal character <2e> in hex
string
Poppler-INFO: Syntax error at position 26: Illegal character <97> in hex
string
It seems that this error occurs on master.
# Expected
Not only poppler_document_new_from_file(), but also
poppler_document_new_from_stream() doesn't cause a syntax error with attached
sample code because both of function handles same pdf file.
# Actual
I've tested attached sample code on debian unstable.(poppler 0.61, poppler-data
0.4.8)
$ dpkg -l G poppler
ii gir1.2-poppler-0.18:amd64 0.61.1-2
amd64 GObject introspection data for poppler-glib
ii libpoppler-dev:amd64 0.61.1-2
amd64 PDF rendering library -- development files
ii libpoppler-glib-dev 0.61.1-2
amd64 PDF rendering library -- development files (GLib interface)
ii libpoppler-glib8:amd64 0.61.1-2
amd64 PDF rendering library (GLib-based shared library)
ii libpoppler72:amd64 0.61.1-2
amd64 PDF rendering library
ii poppler-data 0.4.8-2
all encoding data for the poppler PDF rendering library
ii poppler-utils 0.61.1-2
amd64 PDF utilities (based on Poppler)
In above environment, attached code returns "Syntax error at position xx:".
+ TARGET=poppler-glib-document-new
+ pkg-config --cflags --libs poppler-glib cairo-pdf gio-2.0
+ cc -o poppler-glib-document-new poppler-glib-document-new.c -pthread
-I/usr/include/poppler/glib -I/usr/include/poppler -I/usr/include/cairo
-I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng16
-I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include
-lpoppler-glib -lz -lcairo -lgio-2.0 -lgobject-2.0 -lglib-2.0
+ [ 0 -eq 0 ]
+ G_MESSAGES_DEBUG=Poppler ./poppler-glib-document-new
poppler_document_new_from_file()
poppler_document_new_from_stream()
Poppler-INFO: Syntax error at position 22: Illegal character <21> in hex
string
Poppler-INFO: Syntax error at position 23: Illegal character <59> in hex
string
Poppler-INFO: Syntax error at position 24: Illegal character <f3> in hex
string
Poppler-INFO: Syntax error at position 25: Illegal character <2e> in hex
string
Poppler-INFO: Syntax error at position 26: Illegal character <97> in hex
string
As poppler version is a bit old, I've also tested with master.
<a href="https://cgit.freedesktop.org/poppler/poppler/commit/?id=248aa0f5832ce063a9ae061dfcf54596e0ea5fba">https://cgit.freedesktop.org/poppler/poppler/commit/?id=248aa0f5832ce063a9ae061dfcf54596e0ea5fba</a>
But, it causes syntax error.
+ TARGET=poppler-glib-document-new
+ export PKG_CONFIG_PATH=/home/kenhys/.local/lib/pkgconfig
+ pkg-config --cflags --libs poppler poppler-glib cairo-pdf gio-2.0
+ cc -o poppler-glib-document-new poppler-glib-document-new.c -pthread
-I/home/kenhys/.local/include/poppler/glib
-I/home/kenhys/.local/include/poppler -I/usr/include/cairo
-I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng16
-I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include
-L/home/kenhys/.local/lib -lpoppler -lpoppler-glib -lz -lcairo -lgio-2.0
-lgobject-2.0 -lglib-2.0
+ [ 0 -eq 0 ]
+ LD_LIBRARY_PATH=/home/kenhys/.local/lib G_MESSAGES_DEBUG=Poppler
./poppler-glib-document-new
poppler_document_new_from_file()
poppler_document_new_from_stream()
Poppler-INFO: Syntax error at position -1: Document stream is empty
Error: Failed to load document</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are the assignee for the bug.</li>
</ul>
</body>
</html>