Apple-generated EPS figures in LaTeX-generated PS file cause Ghostscript to segfault

Bug #787067 reported by Daniel Carrasco Guariento
48
This bug affects 7 people
Affects Status Importance Assigned to Milestone
GS-GPL
Invalid
High
ghostscript (Ubuntu)
Fix Released
Medium
Unassigned
Oneiric
Won't Fix
High
Unassigned
Precise
Fix Released
Medium
Unassigned
lcms (Ubuntu)
Fix Released
Medium
Unassigned
Oneiric
Fix Released
Medium
Unassigned
Precise
Won't Fix
Undecided
Unassigned

Bug Description

Binary package hint: ghostscript

On Natty 64-bit, ps2pdf segfaults when converting LaTeX-generated ps files. I have tried running ps2pdf with no extra options, both as a standalone command and from within latexmk and rubber, with the same results.

ProblemType: Bug
DistroRelease: Ubuntu 11.04
Package: ghostscript 9.01~dfsg-1ubuntu5
ProcVersionSignature: Ubuntu 2.6.38-8.42-generic 2.6.38.2
Uname: Linux 2.6.38-8-generic x86_64
Architecture: amd64
CupsErrorLog:

Date: Mon May 23 13:01:29 2011
InstallationMedia: Ubuntu 10.04 LTS "Lucid Lynx" - Release amd64 (20100429)
Lpstat:
 device for ccifusp: lpd://ziza/duplex
 device for lj-duplex: lpd://fma.if.usp.br/ljfma
Papersize: a4
PpdFiles:
 ccifusp: HP Color LaserJet 4700 Postscript (recommended)
 lj-duplex: HP LaserJet p4015dn, hpcups 3.11.1
ProcEnviron:
 LANGUAGE=pt_BR:en
 LANG=pt_BR.UTF-8
 SHELL=/bin/bash
ProcKernelCmdLine: BOOT_IMAGE=/boot/vmlinuz-2.6.38-8-generic root=UUID=0f18b12d-5cc2-4639-a156-4f9768c9252a ro quiet splash vt.handoff=7
SourcePackage: ghostscript
UpgradeStatus: Upgraded to natty on 2011-04-28 (25 days ago)
dmi.bios.date: 07/25/2008
dmi.bios.vendor: Intel Corp.
dmi.bios.version: IDG4510H.86A.0077.2008.0725.1734
dmi.board.asset.tag: To be filled by O.E.M.
dmi.board.name: DG45ID
dmi.board.vendor: Intel Corporation
dmi.board.version: AAE27729-307
dmi.chassis.type: 2
dmi.modalias: dmi:bvnIntelCorp.:bvrIDG4510H.86A.0077.2008.0725.1734:bd07/25/2008:svn:pn:pvr:rvnIntelCorporation:rnDG45ID:rvrAAE27729-307:cvn:ct2:cvr:

Revision history for this message
Daniel Carrasco Guariento (sirwhiteout) wrote :
Revision history for this message
AssfaceJackson (assface-jackson) wrote :

Along with the same problem described above, I also get a segmentation fault when running dvipdf. Very disappointing.

Revision history for this message
Till Kamppeter (till-kamppeter) wrote :

Can you attach the PostScript input files which cause the segmentation fault? Thanks.

Changed in ghostscript (Ubuntu):
status: New → Incomplete
Revision history for this message
Sam Ruby (rubys) wrote :
Revision history for this message
Till Kamppeter (till-kamppeter) wrote :

Adding an "lcms2" task as the previous comment suggests downgrading liblcms2 as a workaround.

Please also test Oneiric (Alpha 3 live CD) as Ghostscript got a lot of fixes and improvements there.

Changed in lcms2 (Ubuntu):
status: New → Incomplete
Revision history for this message
William Spears (williammspears) wrote :

I have the same segmentation violation with ps2pdf with 32bit Ubuntu 11.04. I just finished a book, using Ubuntu 8.04, and had no difficulties. Friday I installed 11.04 and the problems began. The proposed quick fix prevents the segmentation fault, but the final PDF is not quite correct. One thing that is clearly wrong is how .eps graphs are being rendered (the numeric labels are positioned incorrectly). I'm wondering if there has been any progress in this. I might be able to post the DVI, PS and PDF of a portion of the book if that helped. I'm using texlive. Sorry if I'm not providing the info you need - I'm a newbie at reporting Linux problems - ask me if you need further info. Thanks

Revision history for this message
William Spears (williammspears) wrote :

If one examines the dvi with xdvi, it looks ok, but each time a graph is on that page, the following warning appears:

gs: GPL Ghostscript 9.01: Warning: the Xfonts feature is deprecated and will be removed in a future release.

If one examines the PS file with gv or evince, the numbers on the labels of the graphs do not appear.

When the PDF file is created, the numbers are moved from where they should be.

I *was* using Ghostscript 8.61 in Ubuntu 11.04, and am wondering if it is really Ghostscript 9.01 that is causing the problem, as opposed to ps2pdf.

Revision history for this message
Till Kamppeter (till-kamppeter) wrote :

William, can you try Oneiric with a live CD as suggested in comment #5. Thanks.

Revision history for this message
William Spears (williammspears) wrote :

Till, unfortunately I don't fully understand how to do that. I've experimented some more and believe there are several problems. One is with "ghostscript" - it appears to be called by xdvi, and doesn't play well with it. If you xdvi the dvi file and zoom in to level 5 of zoom, the right border gets chopped off. Also, as you know, there is the ps2pdf problem. Finally, the dvips command that comes with the newest texlive doesn't seem correct either.

What I've done is re-install ghostscript 8.61, texlive from year 2010, and the "fixed" ps2pdf and things are looking better (although still not the same byte for byte). I still need to do a page by page comparison with my old saved pdf file...

The newer ghostscript and texlive aren't playing well together, for reasons that are beyond me.

Revision history for this message
Till Kamppeter (till-kamppeter) wrote :

William, download a Desktop CD image from Ubuntu Oneiric (Beta 1), burn it onto a CD, and boot with this CD. As soon as you arrive at the live session desktop, update the live system by running

sudo apt-get update
sudo apt-get upgrade

in a terminal window and after that install texlive. Then try to do your ps2pdf and dvipdf operations in this environment to check whether they work better.

This does not affect your orriginal system. All package installations into the live system are done in a temporary storage.

Revision history for this message
William Spears (williammspears) wrote :

Till, thanks for replying. I presume you mean this guy?

http://releases.ubuntu.com/oneiric/ubuntu-11.10-beta1-desktop-i386.iso

After doing this I presume I can see my normal file system on my HD so I can
try to "recompile" my latex?

Sorry for all the questions - the last time I sysoped was in the 80s on one of
the first Sun Sparc machines and things have changed a LOT. Catching up as
fast as I can. Thanks, Bill

Revision history for this message
Till Kamppeter (till-kamppeter) wrote :

AFAIK the file systems of the hard disk get mounted in a live session, or at least they can be mounted by a simple operation (desktop icon or "Places" menu).

Revision history for this message
William Spears (williammspears) wrote :

OK, thanks. Will try. Looks like my CD/DVD drive is crapping out (lots of chattering),
so need to order new one and then will give this a shot. Unfortunately, using unetbootin-linux
isn't working either for a live boot from USB... argh.

Revision history for this message
William Spears (williammspears) wrote :

OK, after much work today, I can answer that the same problem occurs with Ubuntu Oneiric (Beta 1). A live install wasn't good enough because there was insufficient space to hold texlive. So, I did the full install on HD. ps2pdf still crashes with a segmentation violation. I'm now going to painfully re-install 11.04 and re-apply the fixes. Sigh. There is something definitely bad here.

Revision history for this message
Till Kamppeter (till-kamppeter) wrote :

Unfortunately, I cannot do anything as I do not have any sample PostScript file. Can you attach one? Thanks.

Revision history for this message
William Spears (williammspears) wrote :

OK, I'm backing everything up and will re-install Ubuntu 11.04 in a few hours. Then I'll copy my files back. When that happens I'll try to create a PS file for you. The current one is a whole book, which Springer would not be happy about if I released. So, I'll see if I can make one chapter and see if ps2pdf will crash. Of course, this will involve installing texlive again, which takes a while. I'll either stay up all night, or work on this tomorrow after some sleep. Thanks.

Changed in ghostscript (Ubuntu):
importance: Undecided → Medium
Changed in lcms2 (Ubuntu):
importance: Undecided → Medium
Revision history for this message
William Spears (williammspears) wrote :

Till, finally got some sleep and I'm trying things out now... Thanks, Bill

Revision history for this message
William Spears (williammspears) wrote :

Till, can I email you a link? Is your email address the gmail address you provide?

Revision history for this message
Till Kamppeter (till-kamppeter) wrote :

Yes, please do so. The address is correct.

Revision history for this message
Till Kamppeter (till-kamppeter) wrote :

Succeeded to capture a crash now. the stack trace is in bug 857948.

Revision history for this message
Till Kamppeter (till-kamppeter) wrote :

Generally, it crashes on Apple-generated EPS figures, and it does not even need the PDF output for that. Screen display via

gs <file>

is enough to trigger the crash.

Attaching samples ...

Revision history for this message
Till Kamppeter (till-kamppeter) wrote :

First offending figure

Revision history for this message
Till Kamppeter (till-kamppeter) wrote :

Second offending figure

Revision history for this message
Till Kamppeter (till-kamppeter) wrote :

Third offending figure

summary: - ps2pdf segmentation fault
+ Apple-generated EPS figures in LaTeX-generated PS file cause Ghostscript
+ to segfault
Changed in ghostscript (Ubuntu):
importance: Medium → High
status: Incomplete → Confirmed
Changed in lcms2 (Ubuntu):
status: Incomplete → Confirmed
Changed in ghostscript (Ubuntu):
milestone: none → ubuntu-11.10
Revision history for this message
Till Kamppeter (till-kamppeter) wrote :

Reported the problem also to the upstream developers of Ghostscript (http://bugs.ghostscript.com/show_bug.cgi?id=692539). Thank you for the sample files.

Revision history for this message
William Spears (williammspears) wrote :

You are welcome - I hope these help.

Changed in gs-gpl:
importance: Unknown → High
status: Unknown → Confirmed
Revision history for this message
Till Kamppeter (till-kamppeter) wrote :

Corrected LCMS task, GS is linked against lcms1.

affects: lcms2 (Ubuntu) → lcms (Ubuntu)
Revision history for this message
Till Kamppeter (till-kamppeter) wrote :

A possible solution is to build Ghostscript with the new liblcms2. At least for me it does not crash any more on your EPS files. But as this is a major change and the upstream developers of Ghostscript think that there are still bugs, and this case of Apple-generated EPS files is the only know cause of Ghostscript to segfault, I cannot put this change into Oneiric. But I make it available for you and everyone who actually suffers this problem. It is on my PPA:

https://launchpad.net/~till-kamppeter/+archive/ppa

Please follow the instructions under "Adding this PPA to your system". After that update your system, for example via

sudo apt-get update
sudo apt-get dist-upgrade

After more testing (by me, by you, and by the development of Ubuntu 12.04) I will check whether we can upload this package as SRU (Stable Release Update) for Oneiric. Especially it needs to be tested whether the switchover from liblcms1 to liblcms2 does not introduce any regressions.

Changed in lcms (Ubuntu Oneiric):
status: Confirmed → Invalid
Changed in ghostscript (Ubuntu Oneiric):
status: Confirmed → Won't Fix
Changed in lcms (Ubuntu Oneiric):
status: Invalid → Won't Fix
Revision history for this message
Till Kamppeter (till-kamppeter) wrote :

liblcms1 (lcms package) is not maintained any more upstream, so we should aim on switching our Ghostscript package to liblcms2 (lcms2) instead of trying to fix libcms1 (the copy of libcms1 shipped with the Ghostscript source is also heavily patched). So in the P cycle we should provide a liblcms2-based Ghostscript early to get as much testing as possible.

Closing lcms tasks and Oneiric task for Ghostscript.

Changed in ghostscript (Ubuntu):
milestone: ubuntu-11.10 → none
status: Confirmed → Triaged
importance: High → Medium
Revision history for this message
William Spears (williammspears) wrote :

Till, thank you - this indeed seems to work. I went through my 675 page book, with the 3 "offending figures", using ghostscript 9.04, and it all looks correct!

Changed in gs-gpl:
status: Confirmed → Invalid
Revision history for this message
Lars Karlitski (larsu) wrote :

Attached is a small patch (hack), which sanitizes an internal lcms struct to prevent this crash from happening. However, it writes an incorrect color profile to the resulting pdf. Evince complains about that on the command line, but renders all images (probably not in the correct colors).

Revision history for this message
Till Kamppeter (till-kamppeter) wrote :

Lars, thank you for your patch. It actually works for me. Looking into the patch one sees that it does not change anything in cases where the segfault did not happen before, it only kicks in in cases where there was the segfault, so there should be no regression potential.

Changed in ghostscript (Ubuntu Oneiric):
status: Won't Fix → Triaged
status: Triaged → Won't Fix
Changed in lcms (Ubuntu Oneiric):
status: Won't Fix → Triaged
Revision history for this message
Till Kamppeter (till-kamppeter) wrote :

The patch would be a good workaround for Oneiric, for the time until we get P where Ghostscript will use liblcms2. Reopening lcms task for Oneiric.

Revision history for this message
Ubuntu Foundations Team Bug Bot (crichton) wrote :

The attachment "lcms-assure-lut.patch" of this bug report has been identified as being a patch. The ubuntu-reviewers team has been subscribed to the bug report so that they can review the patch. In the event that this is in fact not a patch you can resolve this situation by removing the tag 'patch' from the bug report and editing the attachment so that it is not flagged as a patch. Additionally, if you are member of the ubuntu-sponsors please also unsubscribe the team from this bug report.

[This is an automated message performed by a Launchpad user owned by Brian Murray. Please contact him regarding any issues with the action taken in this bug report.]

tags: added: patch
Changed in lcms (Ubuntu Oneiric):
milestone: none → ubuntu-11.10
Revision history for this message
Till Kamppeter (till-kamppeter) wrote :

debdiff to fix the problem in Oneiric via the "lcms" package is attached. The fix is a trivial NULL-pointer check, so no regression potential.

Changed in lcms (Ubuntu Oneiric):
status: Triaged → Fix Committed
Revision history for this message
Till Kamppeter (till-kamppeter) wrote :

Second attempt, the first debdiff contained an irrelevant temporary file, blowing up the source package.

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package lcms - 1.19.dfsg-1ubuntu2

---------------
lcms (1.19.dfsg-1ubuntu2) oneiric; urgency=low

  * src/cmslut.c: Added NULL pointer check to prevent Ghostscript from crashing
    on Apple-generated EPS files (LP: #787067).
 -- Till Kamppeter <email address hidden> Thu, 6 Oct 2011 11:25:00 +0200

Changed in lcms (Ubuntu Oneiric):
status: Fix Committed → Fix Released
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package ghostscript - 9.04~dfsg-0ubuntu12

---------------
ghostscript (9.04~dfsg-0ubuntu12) precise; urgency=low

  * debian/patches/1001_dont-crash-when-not-finding-icc-profile.patch,
    debian/patches/020110923-5688545-fix-setting-the-iccprofilesdir-userparam.patch,
    debian/patches/020110923-7e048c5-dont-crash-when-not-finding-icc-profile.patch:
    Patch got applied upstream, replaced the patch by "official" upstream GIT
    patches. No change in source code.
  * debian/control, debian/rules: Build Ghostscript against liblcms instead
    of liblcms1, to fix a crash on Apple-generated EPS figures (both
    standalone or embedded in LaTeX-generated PostScript files, LP: #787067).
  * debian/control, debian/rules, debian/libgs__VER__.install.in,
    debian/libgs-dev.install: Stop using d-shlibmove, it is not compatible
    with libcms2.
  * debian/symbols.common: Updated. Applied patch which dpkg-gensymbols
    generated for debian/libgs9.symbols to this file.
 -- Till Kamppeter <email address hidden> Mon, 17 Oct 2011 15:52:31 +0200

Changed in ghostscript (Ubuntu Precise):
status: Triaged → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.