[Poppler-bugs] [Bug 63862] New: poppler generates bad postscript when PDF document title contains newline

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Tue Apr 23 21:48:37 PDT 2013


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

          Priority: medium
            Bug ID: 63862
          Assignee: poppler-bugs at lists.freedesktop.org
           Summary: poppler generates bad postscript when PDF document
                    title contains newline
          Severity: normal
    Classification: Unclassified
                OS: All
          Reporter: duncan at ecs.vuw.ac.nz
          Hardware: All
            Status: NEW
           Version: unspecified
         Component: general
           Product: poppler

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

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


More information about the Poppler-bugs mailing list