Regression: unable to create caption with convert tool

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
user21089
Posts: 3
Joined: 2016-06-04T08:42:49-07:00
Authentication code: 1151

Regression: unable to create caption with convert tool

Post by user21089 »

After an update from Debian oldstable to Jessie, the convert command locks my CPU up at 100% and never completes (even after a long time). The caption is specified using a @ syntax that's generated by Moviepy and previously worked just fine. Specifying the caption as text works around this regression.

Steps to reproduce:
  • 1. echo "test" > test.txt

    2. convert -background transparent -fill white -font Helvetica -size 1920x121.2 -gravity south caption:@test.txt -type truecolormatte PNG32:/tmp/tmpZzdLtm.png

Observed results:


CPU stuck at 100%

Expected results:


Process finishes after a few seconds and generates the transparent image with text in it. I also tried changing all the other parameters (font, size, gravity, etc.) and it produces the same behavior.

Running just

Code: Select all

convert caption:@test.txt -type truecolormatte PNG32:/tmp/tmpZzdLtm.png
Results in:

Code: Select all

convert: not authorized `@test.txt' @ error/property.c/InterpretImageProperties/3307.
Version

Code: Select all

convert -version
Version: ImageMagick 6.8.9-9 Q16 x86_64 2016-05-16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2014 ImageMagick Studio LLC
Features: DPC Modules OpenMP
Delegates: bzlib cairo djvu fftw fontconfig freetype jbig jng jpeg lcms lqr ltdl lzma openexr pangocairo png rsvg tiff wmf x xml zlib
The command is generated by the following Moviepy code:

Code: Select all

txt_clip = ( TextClip(fullLine,color='white',method='caption',size=(clip.size[0],clip.size[1]*0.15),font='Helvetica',align="south")
                .set_duration(4)
                .set_position(("center","bottom")) )
However, I don't consider this to be the root cause, as it worked before using the same generated syntax.

Could you fix this, and, ideally, please give me a workaround to generate captions based on a text file?

Thanks
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Regression: unable to create caption with convert tool

Post by magick »

Check your policy.xml configuration file. Debian likely added a policy preventing the use of indirect reads in response to recent security vulnerabilitie reports (e.g. convert label:@/etc/passwd passwd.png). If you remove the '@' policy you should be able to use caption:@test.txt again.
user21089
Posts: 3
Joined: 2016-06-04T08:42:49-07:00
Authentication code: 1151

Re: Regression: unable to create caption with convert tool

Post by user21089 »

Interesting! Indeed the policy.xml file in the package maintainer's version removed the rights to use the @ indirection. However, when I commented this out I had only partial success.

The following succeeds now:

Code: Select all

convert  -gravity south caption:@test.txt -type truecolormatte PNG32:/tmp/tmp968ZtD.png
But the following still hangs at 100%:

Code: Select all

convert -size 632x55 -gravity south caption:@test.txt -type truecolormatte PNG32:/tmp/tmp968ZtD.png
I also commented out all the other policies in case it was a similar issue, with no change in behavior.

Can I also request that the failure mode be changed from 100% CPU usage to an error message?

Thanks for the help so far
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Regression: unable to create caption with convert tool

Post by magick »

Thanks for the problem report. We can reproduce it and will have a patch to fix it in GIT master branch @ https://github.com/ImageMagick/ImageMagick later today. The patch will be available in the beta releases of ImageMagick @ http://www.imagemagick.org/download/beta/ by sometime tomorrow.
user21089
Posts: 3
Joined: 2016-06-04T08:42:49-07:00
Authentication code: 1151

Re: Regression: unable to create caption with convert tool

Post by user21089 »

Thanks for such quick response times! After some research I figured out how to build the latest code on my Debian system (the Debian build log from the package maintainer helped https://buildd.debian.org/status/fetch. ... 1464822354) and I confirmed that the bug is fixed!

Great work
Post Reply