Bug 700350

Summary: GS seg fault
Product: Ghostscript Reporter: John Haggerty <haggerty>
Component: PDF InterpreterAssignee: Ken Sharp <ken.sharp>
Status: RESOLVED DUPLICATE    
Severity: normal    
Priority: P4    
Version: 9.25   
Hardware: Macintosh   
OS: MacOS X   
Customer: Word Size: ---
Attachments: Example file to crash Ghostscript

Description John Haggerty 2018-12-08 05:24:50 UTC
Created attachment 16523 [details]
Example file to crash Ghostscript

Ghostscript 9.26 seg faults when making thumbnails in the elog program I use.  Here's the command line that is generated by a call from Imagemagick:

gs -sstdout=%stderr -dSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dAlignToPixels=0 -dGridFitTT=2 '-sDEVICE=pngalpha' -dTextAlphaBits=4 -dGraphicsAlphaBits=4 '-r72x72' -dFirstPage=1 -dLastPage=8 -sOutputFile=xxx-%d.png crashghost.pdf

Here's some output:

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 2.
Page 1
Segmentation fault: 11

I'm using a brew installed ghostscript 9.26 on a Mac (10.14.1).

I've tried a variety of fixes (building from source, installing from a dmg), but the only thing that doesn't crash is going back to 9.23.

The command works if you change pngalpha to png16m.
Comment 1 Ken Sharp 2018-12-08 12:37:59 UTC
Almost certainly a duplicate of this bug

*** This bug has been marked as a duplicate of bug 700315 ***
Comment 2 Ken Sharp 2018-12-08 12:43:03 UTC
When you say 'building from source' which SHA1 do you mean ? You've put 9.25 in the version field (I appreciate we've forgotten to add 9.26), is that the version you used, or are you building from the current or recent HEAD ?
Comment 3 John Haggerty 2018-12-08 13:55:55 UTC
(In reply to Ken Sharp from comment #2)
> When you say 'building from source' which SHA1 do you mean ? You've put 9.25
> in the version field (I appreciate we've forgotten to add 9.26), is that the
> version you used, or are you building from the current or recent HEAD ?

I did a brew install ghostscript which gave me 9.26 built by the brew gods, then I tried a --build-from-source build, then a --HEAD, but I'm not expert enough to know what versions I'm actually getting (other than the 9.26 that gs reports).

My searches somehow didn't show up that other bug report, it looks like you already squashed this bug, thanks!
Comment 4 Ken Sharp 2018-12-08 14:08:24 UTC
(In reply to John Haggerty from comment #3)

> I did a brew install ghostscript which gave me 9.26 built by the brew gods,
> then I tried a --build-from-source build, then a --HEAD, but I'm not expert
> enough to know what versions I'm actually getting (other than the 9.26 that
> gs reports).

OK if its reporting 9.26 then you aren't using the current HEAD from our repository, because that self-identifies as 9.17 pre-release.

 
> My searches somehow didn't show up that other bug report, it looks like you
> already squashed this bug, thanks!

It does sound like it, there have been several duplicates of this problem. If you can clone from our Git repository you should be able to build that. Alternatively, if you take the existing source you have and apply the patch here:

http://git.ghostscript.com/?p=ghostpdl.git;a=commit;h=fae21f1668d2b44b18b84cf0923a1d5f3008a696

and rebuild, then that will probably solve your problem.

*** This bug has been marked as a duplicate of bug 700315 ***