Bug 20420 - pdftops produces broken Postscript
Summary: pdftops produces broken Postscript
Status: RESOLVED FIXED
Alias: None
Product: poppler
Classification: Unclassified
Component: general (show other bugs)
Version: unspecified
Hardware: Other All
: medium normal
Assignee: poppler-bugs
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-03-02 04:00 UTC by Till Kamppeter
Modified: 2009-06-04 11:27 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments
PDF file from which pdftops produces broken PostScript (499.18 KB, application/pdf)
2009-03-02 04:00 UTC, Till Kamppeter
Details
Patch to fix this bug (529 bytes, patch)
2009-06-04 09:19 UTC, Till Kamppeter
Details | Splinter Review

Description Till Kamppeter 2009-03-02 04:00:57 UTC
Created attachment 23437 [details]
PDF file from which pdftops produces broken PostScript

The PostScript which comes out when converting the attached PDF file via

pdftops afdruk.pdf

is broken. Ghostscript 8.64 gives the following error:

till@till-laptop:~/ghostscript/gpl/testfiles$ gs afdruk.ps
GPL Ghostscript 8.64 (2009-02-03)
Copyright (C) 2009 Artifex Software, Inc.  All rights reserved.
This software comes with NO WARRANTY: see the file PUBLIC for details.
Error: /syntaxerror in -file-
Operand stack:
   --nostringval--   --nostringval--   --nostringval--   19
Execution stack:
   %interp_exit   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--   --nostringval--   --nostringval--   false   1   %stopped_push   1862   1   3   %oparray_pop   1861   1   3   %oparray_pop   1845   1   3   %oparray_pop   1739   1   3   %oparray_pop   --nostringval--   %errorexec_pop   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push
Dictionary stack:
   --dict:1147/1684(ro)(G)--   --dict:0/20(G)--   --dict:70/200(L)--   --dict:87/150(L)--
Current allocation mode is local
Current file position is 257319
GPL Ghostscript 8.64: Unrecoverable error, exit code 1
till@till-laptop:~/ghostscript/gpl/testfiles$ 

till@till-laptop:~/ghostscript/gpl/testfiles$ pdftops --version
Error: Couldn't open file '--version'
till@till-laptop:~/ghostscript/gpl/testfiles$ pdftops -version
Error: Couldn't open file '-version'

Version of pdftops:

till@till-laptop:~/ghostscript/gpl/testfiles$ pdftops
pdftops version 0.10.3
Copyright 2005-2009 The Poppler Developers - http://poppler.freedesktop.org
Copyright 1996-2004 Glyph & Cog, LLC
Usage: pdftops [options] <PDF-file> [<PS-file>]
...
till@till-laptop:~/ghostscript/gpl/testfiles$ 

Problem was observed on Ubuntu Intrepid and Jaunty. Original bug report:

https://bugs.edge.launchpad.net/ubuntu/+source/poppler/+bug/335397
Comment 1 Till Kamppeter 2009-06-04 09:19:02 UTC
Created attachment 26437 [details] [review]
Patch to fix this bug

I have found the cause of the problem. ASCII85-encoded binary data was not correctly copied from the PDF input file. Patch attached.
Comment 2 Albert Astals Cid 2009-06-04 11:04:55 UTC
It seems i already commited that patch in master as part of other bugfix, can you confirm git master is ok? The attached document seems to work.
Comment 3 Till Kamppeter 2009-06-04 11:13:17 UTC
I do not have the GIT repo of Poppler handy here, but if you have checked that the attached file is correctly converted (result displays with Ghostscript or prints on PS printer when sending unfiltered) it is OK and you can mark the bug as fixed. You can also check the poppler/PSOutputDev.cc file whether my two insertions are actually there.
Comment 4 Till Kamppeter 2009-06-04 11:19:13 UTC
I have checked in the web interface of the GIT repo now. There is only one of my insertions, the one where the array gets actually written. This fixes the bug but the array will be created one unit too big. In my patch I do the same insertion also in the pre-calculation of the array size. See my patch and compare with

http://cgit.freedesktop.org/poppler/poppler/tree/poppler/PSOutputDev.cc
Comment 5 Albert Astals Cid 2009-06-04 11:27:12 UTC
Right, i did not check correctly and was misled by a similar check in the above line.

Commited now.


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.