Bug 702868 - Segmentation fault when using dPDFSETTINGS
Summary: Segmentation fault when using dPDFSETTINGS
Status: RESOLVED FIXED
Alias: None
Product: Ghostscript
Classification: Unclassified
Component: PDF Writer (show other bugs)
Version: 9.26
Hardware: PC Linux
: P4 normal
Assignee: Default assignee
QA Contact: Bug traffic
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-09-08 11:40 UTC by Violeta
Modified: 2020-09-10 14:45 UTC (History)
1 user (show)

See Also:
Customer:
Word Size: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Violeta 2020-09-08 11:40:45 UTC
I get a segmentation fault when trying to process a specific pdf with different dPDFSETTINGS. It works fine if I use -dPDFSETTINGS=/default or -dPDFSETTINGS=/printer, but otherwise it just segfaults. It doesn't happen with all pdfs.

(gdb) run -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/screen -dNOPAUSE -dBATCH -sOutputFile=output.pdf input.pdf 
Starting program: /usr/bin/gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/screen -dNOPAUSE -dBATCH -sOutputFile=output.pdf input.pdf
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
GPL Ghostscript 9.26 (2018-11-20)
Copyright (C) 2018 Artifex Software, Inc.  All rights reserved.
This software comes with NO WARRANTY: see the file PUBLIC for details.
Processing pages 1 through 6.
Page 1
Page 2
Page 3

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff6e8ef57 in ?? () from /usr/lib/x86_64-linux-gnu/libgs.so.9

------

uname -a
Linux 5.4.0-42-generic #46~18.04.1-Ubuntu SMP Fri Jul 10 07:21:24 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux


------

libgs9/bionic-updates,bionic-security,now 9.26~dfsg+0-0ubuntu0.18.04.13 amd64 [installed,automatic]

---------


I tried installing different package versions to see if it changed anything, but I had the same issue.
I tried with:
libgs9-common=9.22~dfsg+1-0ubuntu1 libgs9=9.22~dfsg+1-0ubuntu1 ghostscript=9.22~dfsg+1-0ubuntu1
Comment 1 Peter Cherepanov 2020-09-08 15:26:01 UTC
Please attach your PDF file.
Comment 2 Ray Johnston 2020-09-08 17:31:25 UTC
Also, I request that you test with the 9.53.0 release candidate available at

https://github.com/ArtifexSoftware/ghostpdl-downloads/releases/tag/ghostpdl-9.53.0rc2

If it works with that release, we've already fixed it (probably the case).
Comment 3 Violeta 2020-09-09 07:53:29 UTC
Hi,


Unfortunately I can't provide the PDF as it has private information. Is there anything else I could do instead?

I have installed 9.53.0 and it still segfaults:

gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/ebook -dNOPAUSE -dBATCH -sOutputFile=Meeting_Brief_20200813_small-gs9.53.0.pdf Meeting_Brief_20200813.pdf 
GPL Ghostscript RELEASE CANDIDATE 2 9.53.0 (2020-08-27)
Copyright (C) 2020 Artifex Software, Inc.  All rights reserved.
This software is supplied under the GNU AGPLv3 and comes with NO WARRANTY:
see the file COPYING for details.
Processing pages 1 through 6.
Page 1
Page 2
Page 3
Segmentation fault (core dumped)
Comment 4 Ken Sharp 2020-09-09 08:12:51 UTC
(In reply to Violeta from comment #3)

> Unfortunately I can't provide the PDF as it has private information. Is
> there anything else I could do instead?

There are basically three options:

1) If you're prepared to share the file, just not publicly, send it to one of us. You can either email it (not exactly secure) or place it on a secure site and tell us (by email) how to retrieve it. You may find it easier to discuss this with us in real-time. You can talk to us in the #ghostscript IRC channel on freenode. Best time is UK office hours but there can be developers there more or less any time.

2) You can find another problem file which you can share, or redact/remove the private information from the original file (making sure it still fails afterwards, obviously). We can't work on your problem in the dark, we need the file and command line to find and solve the bug.

3) You could debug the problem yourself, we're open to accepting patches form the community, though we would need at least some explanation of the problem.
Comment 5 Peter Cherepanov 2020-09-10 06:08:00 UTC
I found a file that fails with -dPDFSETTINGS=/ebook but runs to completion without -dPDFSETTINGS. This happens on the current development version in debug and release builds. The file is too big to attach but can be downloaded here
http://www.eci.org/_media/downloads/altona_test_suite/eci_altona-test-suite-v2_technical2_one-patch-per-page_x4.pdf
Comment 7 Ken Sharp 2020-09-10 14:45:31 UTC
Commit 89ff7003acfdc52e3d3bcca930de6961f33ae927 fixes this problem.

While working on it I uncovered a different issue (which is unlikely ever to cause a real-world problem) and this is tracked in bug 702885