security error trying to convert jpg to pdf

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
Post Reply
shochatd
Posts: 4
Joined: 2019-06-28T13:23:25-07:00
Authentication code: 1152

security error trying to convert jpg to pdf

Post by shochatd »

I attempted to perform what I thought was a very straightforward conversion using the command:
convert Deluge1.jpg Deluge1.pdf
I got the following error message:
convert-im6.q16: attempt to perform an operation not allowed by the security policy `PDF' @ error/constitute.c/IsCoderAuthorized/408.
I'm sure I've done this in the past without error. And I have no idea why there would be any security issue here.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: security error trying to convert jpg to pdf

Post by fmw42 »

What is your IM version and platform? Where did ImageMagick come from? How was it installed. Please see the policy.xml file for security related permissions and arguments. https://imagemagick.org/script/resources.php
shochatd
Posts: 4
Joined: 2019-06-28T13:23:25-07:00
Authentication code: 1152

Re: security error trying to convert jpg to pdf

Post by shochatd »

This is on Ubuntu 19.04. dpkg -l imagemagick says:
||/ Name Version Architecture Description
+++-==============-===========================-============-=======================================
ii imagemagick 8:6.9.10.14+dfsg-7ubuntu2.2 amd64 image manipulation programs -- binaries
I've had this on my system for years. I suppose this version was installed from a routine software update.
In policy.xml I see 2 possible culprits:
1.

Code: Select all

 <!-- <policy domain="module" rights="none" pattern="{PS,PDF,XPS}" /> -->
2.

Code: Select all

  <!-- disable ghostscript format types -->
  <policy domain="coder" rights="none" pattern="PS" />
  <policy domain="coder" rights="none" pattern="EPS" />
  <policy domain="coder" rights="none" pattern="PDF" />
  <policy domain="coder" rights="none" pattern="XPS" />
I don't get what the rationale for this could be.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: security error trying to convert jpg to pdf

Post by fmw42 »

The default policy precludes you from reading/writing PDF, etc. This was due to a security bug in Ghostscript, which has now been fixed. I suggest you uncomment those policies and make them rights="read|write. See if that helps.
shochatd
Posts: 4
Joined: 2019-06-28T13:23:25-07:00
Authentication code: 1152

Re: security error trying to convert jpg to pdf

Post by shochatd »

Thanks. I had found some documentation about the ghostscript issue but I did not know that it had been fixed. I realized that my "culprit 1" was already commented out, so I tried simply commenting out the 2nd to last policy line (the one mentioning PDF) and that solved the problem.
-- David
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: security error trying to convert jpg to pdf

Post by fmw42 »

It is fixed in the current 9.27 version of GS, but that version has other bugs as does 9.26
shochatd
Posts: 4
Joined: 2019-06-28T13:23:25-07:00
Authentication code: 1152

Re: security error trying to convert jpg to pdf

Post by shochatd »

I'm at 9.26. I guess that's why those policy lines are in the current copy of policy.xml on my system.
Post Reply