Closed lvonk closed 5 years ago
Same issue for me, and I found this.
Bug #1806517 “Ghostscript segmentation fault onb PDF using -dFir...” : Bugs : GS-GPL
Subscribing Ubuntu Security Team as this is a regression caused by the recent security updates.
Same issue for me:
Some '.pdf' files doesn't want to open with MiniMagick
pdf = MiniMagick::Image.open(pdf_file)
If I look at pdf.data
I get the error:
MiniMagick::Error: `convert /var/folders/p9/8s4hyff50hl_821gd7r6dmmh0000gn/T/mini_magick20190417-66256-klm1ju.pdf[0] json:` failed with error:
convert: FailedToExecuteCommand `'gs' -sstdout=%stderr -dQUIET -dSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dAlignToPixels=0 -dGridFitTT=2 '-sDEVICE=pngalpha' -dTextAlphaBits=4 -dGraphicsAlphaBits=4 '-r72x72' -dFirstPage=1 -dLastPage=1 '-sOutputFile=/var/folders/p9/8s4hyff50hl_821gd7r6dmmh0000gn/T/magick-69397xb6yWSS0wmFO%d' '-f/var/folders/p9/8s4hyff50hl_821gd7r6dmmh0000gn/T/magick-69397jldpq8J7xwvV' '-f/var/folders/p9/8s4hyff50hl_821gd7r6dmmh0000gn/T/magick-69397MJA2hQISIWNj'' (-1) @ error/delegate.c/ExternalDelegateCommand/478.
convert: no images defined `json:' @ error/convert.c/ConvertImageCommand/3300.
But this happen only on some pdfs (not all).
this makes my day!! Thanks lvonk
image.format "PNG", nil
Hi all, same issue for me with GhostScript 9.26.
I've resolved by editing the policy file for ImageMagick. In /etc/ImageMagick-6/policy.xml i've comment out this row:
And now all is working
what row did you commented out?
Thanks for sharing. I will close the issue as it's not MiniMagick-related, but feel free to keep discussing.
The line that was commented out isn't appearing in the comment above. It is:
policy domain="coder" rights="none" pattern="PDF"
(but with xml tags around it)
This is not really a minimagick issue I think, but I just wanted to share this in case other people start banging their heads over this. So feel free to close immediately. This is related to https://github.com/minimagick/minimagick/issues/472 but it is a different use case.
This issue applies to:
We create thumbnails from a PDF and this started failing since ghostscript released the security update 9.26.
In our code we create png from pdf like this:
This results in a command like
convert document.pdf[0] document.png
. This worked previously, but since the 9.26 security update of ghostscript it started erroring with aconvert: no images defined ....
This also happens when directly calling
convert
. As workaround we now first create a single page pdf from theraw_data
using thecombine_pdf
gem. and pass that into MiniMagick.Passing in
nil
as argument toimage.format
will prevent that the[0]
postfix is added to theconvert
command and the png is created as expected.