Error during converting jpg to pdf

This problems comes from a security update: https://launchpad.net/ubuntu/+source/imagemagick/8:6.8.9.9-7ubuntu5.13

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.


Fixed this on my Ubuntu 16.04.6 LTS and 18.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.


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


Disabling security limitations is a bad habit to get into. The ImageMagick authors presumably made this one for a reason. You should respect that, unless you know exactly what you are doing. That does not seem probable for most people looking at these answers.

The right thing to do in this case is to use other software which the authors themselves believe to be secure.

Here img2pdf fits the bill:

img2pdf --output out.pdf in.jpg