Each time I want to convert jpg file to pdf by this command

convert *.jpg pictures.pdf

I have this error message:

convert: not authorized `pictures.pdf' @ error/constitute.c/WriteImage/1028.

This problems comes from a security update: https://launchpad.net/ubuntu/+source/imagemagick/8:

Someone reported it as a bug: https://bugs.launchpad.net/ubuntu/+source/imagemagick/+bug/1796563

As a temporary fix, I edited /etc/ImageMagick-6/policy.xml and changed the PDF rights from none to read|write there. Not sure about the implications, but at least it allows me to get things done.

  • 1
    I looked into it again, and I'm almost certain that the security fix is related to kb.cert.org/vuls/id/332928 (which documents various ways to bypass -dSAFER in ghostscript). – YoungFrog Oct 9 '18 at 13:13
  • 2
    This indeed works as advertized. I simply commented out (effectively removed) the pdf-line. It would be good to know what the side-effects would be! The policymap in the config file comments that this is for "disable ghostscript format types". – Marten Koetsier Oct 22 '18 at 12:00
  • 1
  • 1
    I was hesitant to change the security settings. As an alternative to imagemagick I used "pdftoppm -jpeg input.pdf output.jpg" (from package named poppler-utils). This alternative was posted in bugs.launchpad.net/ubuntu/+source/imagemagick/+bug/1796563 – Vahid Pazirandeh Jan 18 at 23:31
  • Change destination file format policy respectively <policy domain="coder" rights="read|write" pattern="PDF" /> .Usually they will be at the end .Thanks – yunus Apr 3 at 9:20

If you're worried about the implications, https://bugs.launchpad.net/ubuntu/+source/imagemagick/+bug/1796563 mentions that

While the release notes are not exactly clear, Ghostscript v9.25 seems to make reference to fixing some vulnerabilities of this sort: https://www.ghostscript.com/doc/9.25/News.htm


Fixed this on my Ubuntu 16.04.6 LTS by following accepted answer.

Created simple sed one-liner to get this fixed faster:

sudo sed -i 's#<policy domain="coder" rights="none" pattern="PDF" />#<policy domain="coder" rights="read|write" pattern="PDF" />#' /etc/ImageMagick-6/policy.xml

and in programmatic way.

protected by N0rbert Mar 14 at 10:53

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.