<html>
<head>
<base href="https://bugs.freedesktop.org/" />
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Priority</th>
<td>medium
</td>
</tr>
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW --- - poppler generates bad postscript when PDF document title contains newline"
href="https://bugs.freedesktop.org/show_bug.cgi?id=63862">63862</a>
</td>
</tr>
<tr>
<th>Assignee</th>
<td>poppler-bugs@lists.freedesktop.org
</td>
</tr>
<tr>
<th>Summary</th>
<td>poppler generates bad postscript when PDF document title contains newline
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr>
<tr>
<th>OS</th>
<td>All
</td>
</tr>
<tr>
<th>Reporter</th>
<td>duncan@ecs.vuw.ac.nz
</td>
</tr>
<tr>
<th>Hardware</th>
<td>All
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Version</th>
<td>unspecified
</td>
</tr>
<tr>
<th>Component</th>
<td>general
</td>
</tr>
<tr>
<th>Product</th>
<td>poppler
</td>
</tr></table>
<p>
<div>
<pre>This bug was actually noticed when using okular (0.14.3) to view a file that
had a "\r\n" sequence in it's name (don't ask!) and requesting that the
document be printed to a postscript printer or saved as a postscript file. The
version of poppler installed here is currently 0.20.5, but from a quick look at
the sources the same issue is present in 0.22.3.
Okular uses poppler to convert the document to postscript before printing or
saving, and the resulting postscript file contains a "%%Title" line which has
the name of the file in it. The postscript file is therefore syntactically
incorrect as the part of the file name following the "\r\n" occurs at the start
of a line with no preceding comment character.
Arguably the fault is with okular, but it's possible that other applications
using poppler could trigger the same issue and so a fix in poppler seems to me
to be the best option.
I propose sanitising the contents of psTitle immediately before the call to
writePSFmt() in
if(psTitle) {
writePSFmt("%%Title: {0:s}\n", psTitle);
}
at line 1416 of poppler/PSOutputDev.cc.
Apologies for not including a tested patch, but my C++ is not strong, so I'm
not sure if code using the standard C function index() (or perhaps strspn() or
similar) is the appropriate way to fix this. Also, our current environment is
in the process of upgrading from poppler 0.20.5 to 0.22.3 and right now it
would be awkward to attempt to build either the older or new version! If no
one comes up with a response to this before our environment has the new version
installed I will attempt to do so...
Duncan</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>