GNU bug report logs - #34296
ghostscript segfaults with “pdfwrite” device

Previous Next

Package: guix;

Reported by: Ricardo Wurmus <rekado <at> elephly.net>

Date: Sun, 3 Feb 2019 11:41:02 UTC

Severity: normal

Done: Ricardo Wurmus <rekado <at> elephly.net>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 34296 in the body.
You can then email your comments to 34296 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-guix <at> gnu.org:
bug#34296; Package guix. (Sun, 03 Feb 2019 11:41:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Ricardo Wurmus <rekado <at> elephly.net>:
New bug report received and forwarded. Copy sent to bug-guix <at> gnu.org. (Sun, 03 Feb 2019 11:41:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Ricardo Wurmus <rekado <at> elephly.net>
To: bug-guix <at> gnu.org
Subject: ghostscript segfaults with “pdfwrite” device
Date: Sun, 03 Feb 2019 12:40:27 +0100
I’m trying to generate a single PDF from multiple separate PDF files
that were generated from SVGs with Inkscape.

Here are the SVG files:

  https://git.savannah.gnu.org/cgit/guix/maintenance.git/tree/talks/fosdem-2019/gwl

I’m using this Makefile to generate the final PDF.

--8<---------------cut here---------------start------------->8---
SLIDES=\
  00-title \
  01-process \
  02-process2 \
  03-process3 \
  04-process4 \
  05-process5 \
  06-pipeline \
  07-pipeline2 \
  08-pipeline3 \
  09-pipeline4 \
  10-lies \
  11-environment \
  12-environment2 \
  13-environment-graph \
  14-containers \
  15-container-smoothie \
  30-guix \
  31-guix2 \
  31-guix3 \
  31-guix4 \
  31-guix5 \
  31-guix6 \
  32-gwl \
  33-gwl1 \
  33-gwl2 \
  34-gwl3 \
  34-gwl4 \
  34-gwl5 \
  34-gwl6 \
  35-gwl-free-features \
  36-gwl-new-features \
  98-summary \
  99-end

slides.pdf: $(addsuffix .pdf, ${SLIDES})
	gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile=$@ $^

%.pdf: %.svg
	inkscape -z --export-dpi=300 --export-pdf=$@ $<
--8<---------------cut here---------------end--------------->8---

Run “make slides.pdf” to reproduce the segfault.  This is with
Ghostscript 9.24, but it also happens with 9.25.

The segfault is in “gx_compute_char_matrix”; here’s a backtrace:

--8<---------------cut here---------------start------------->8---
(gdb) bt
#0  0x00007ffff6e31eb0 in gx_compute_char_matrix () from /gnu/store/z8lkz16mzvprg6k7vpcwcjmvhp10myzp-ghostscript-9.25/lib/libgs.so.9
#1  0x00007ffff6e32ad8 in gx_attach_tt_interpreter () from /gnu/store/z8lkz16mzvprg6k7vpcwcjmvhp10myzp-ghostscript-9.25/lib/libgs.so.9
#2  0x00007ffff6e33559 in gx_add_fm_pair () from /gnu/store/z8lkz16mzvprg6k7vpcwcjmvhp10myzp-ghostscript-9.25/lib/libgs.so.9
#3  0x00007ffff6e3212d in gx_lookup_fm_pair () from /gnu/store/z8lkz16mzvprg6k7vpcwcjmvhp10myzp-ghostscript-9.25/lib/libgs.so.9
#4  0x00007ffff6bc85f5 in gs_type42_glyph_outline () from /gnu/store/z8lkz16mzvprg6k7vpcwcjmvhp10myzp-ghostscript-9.25/lib/libgs.so.9
#5  0x00007ffff6e105ba in gs_default_glyph_info () from /gnu/store/z8lkz16mzvprg6k7vpcwcjmvhp10myzp-ghostscript-9.25/lib/libgs.so.9
#6  0x00007ffff6bc87d1 in gs_type42_glyph_info_by_gid () from /gnu/store/z8lkz16mzvprg6k7vpcwcjmvhp10myzp-ghostscript-9.25/lib/libgs.so.9
#7  0x00007ffff6ea7076 in z1_glyph_info_generic () from /gnu/store/z8lkz16mzvprg6k7vpcwcjmvhp10myzp-ghostscript-9.25/lib/libgs.so.9
#8  0x00007ffff6eaeb67 in z42_glyph_info () from /gnu/store/z8lkz16mzvprg6k7vpcwcjmvhp10myzp-ghostscript-9.25/lib/libgs.so.9
#9  0x00007ffff6d3a539 in pdf_process_string () from /gnu/store/z8lkz16mzvprg6k7vpcwcjmvhp10myzp-ghostscript-9.25/lib/libgs.so.9
#10 0x00007ffff6d3b7f7 in process_plain_text () from /gnu/store/z8lkz16mzvprg6k7vpcwcjmvhp10myzp-ghostscript-9.25/lib/libgs.so.9
#11 0x00007ffff6d4759c in pdf_text_process () from /gnu/store/z8lkz16mzvprg6k7vpcwcjmvhp10myzp-ghostscript-9.25/lib/libgs.so.9
#12 0x00007ffff6ee2c8b in op_show_continue_pop () from /gnu/store/z8lkz16mzvprg6k7vpcwcjmvhp10myzp-ghostscript-9.25/lib/libgs.so.9
#13 0x00007ffff6ee309c in zshow () from /gnu/store/z8lkz16mzvprg6k7vpcwcjmvhp10myzp-ghostscript-9.25/lib/libgs.so.9
#14 0x00007ffff6ec6371 in interp () from /gnu/store/z8lkz16mzvprg6k7vpcwcjmvhp10myzp-ghostscript-9.25/lib/libgs.so.9
#15 0x00007ffff6ec6de0 in gs_interpret () from /gnu/store/z8lkz16mzvprg6k7vpcwcjmvhp10myzp-ghostscript-9.25/lib/libgs.so.9
#16 0x00007ffff6ebb539 in gs_main_run_string_end () from /gnu/store/z8lkz16mzvprg6k7vpcwcjmvhp10myzp-ghostscript-9.25/lib/libgs.so.9
#17 0x00007ffff6ebce09 in run_string () from /gnu/store/z8lkz16mzvprg6k7vpcwcjmvhp10myzp-ghostscript-9.25/lib/libgs.so.9
#18 0x00007ffff6ebcf7a in runarg () from /gnu/store/z8lkz16mzvprg6k7vpcwcjmvhp10myzp-ghostscript-9.25/lib/libgs.so.9
#19 0x00007ffff6ebe748 in gs_main_init_with_args () from /gnu/store/z8lkz16mzvprg6k7vpcwcjmvhp10myzp-ghostscript-9.25/lib/libgs.so.9
#20 0x000000000040114b in ?? ()
#21 0x0000000000401350 in ?? ()
#22 0x0000000000405420 in ?? ()
#23 0x0000000000000000 in ?? ()
--8<---------------cut here---------------end--------------->8---

I noticed that it *doesn’t* segfault when only concatenating
00-title.pdf, but it fails with 01-process.pdf.  The relevant difference
seems to be that 00-title.svg refers to the League Gothic OTF font,
while 01-process.svg also uses the “MorrisRoman-Black.ttf” font.

When I remove the three instances where style attributes set
“font-family:'Morris Roman'” the segfault disappears.  It’s also fine if
I replace the font with “TeX Gyre Bonum”, an otf font.  It segfaults
with “DejaVu Sans”, which is mapped to a TTF font.

So my guess is that Ghostscript segfaults when a TTF font is used.

A work-around is to use the pdfimage32 device, which rasterizes the
input PDF file.  For some reason rasterization does NOT lead to a
segfault, even though that would also require Ghostscript to understand
the TTF fonts.

--
Ricardo





Reply sent to Ricardo Wurmus <rekado <at> elephly.net>:
You have taken responsibility. (Tue, 27 Aug 2019 15:47:02 GMT) Full text and rfc822 format available.

Notification sent to Ricardo Wurmus <rekado <at> elephly.net>:
bug acknowledged by developer. (Tue, 27 Aug 2019 15:47:02 GMT) Full text and rfc822 format available.

Message #10 received at 34296-done <at> debbugs.gnu.org (full text, mbox):

From: Ricardo Wurmus <rekado <at> elephly.net>
To: 34296-done <at> debbugs.gnu.org
Cc: Ludovic Courtès <ludo <at> gnu.org>
Subject: Re: bug#34296: ghostscript segfaults with “pdfwrite” device
Date: Tue, 27 Aug 2019 17:46:10 +0200
Ricardo Wurmus <rekado <at> elephly.net> writes:

> I’m trying to generate a single PDF from multiple separate PDF files
> that were generated from SVGs with Inkscape.
[…]
> Run “make slides.pdf” to reproduce the segfault.  This is with
> Ghostscript 9.24, but it also happens with 9.25.

The problem has been fixed!  I think the fix was provided in commit
466ff55c72959ba1499ce3ec69f534b3038eb30b, which addressed another
Ghostscript problem.

See https://issues.guix.gnu.org/issue/34877 for details.

--
Ricardo





bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 25 Sep 2019 11:24:07 GMT) Full text and rfc822 format available.

This bug report was last modified 4 years and 209 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.