Slow to convert HP PCL printer data
Swiss army knife of image processing
Brought to you by:
bfriesen
As of changeset 15965:09a101f0a1a3, gm convert is extremely to process HPGL files. On my machine, it took 282s and 21s to run against the attached files with gm convert $FILE /dev/null respectively.
It may be necessary to apply some more checks before delegating to hp2xx (ImageMagick exits immediately).
BTW, since we basically apply fuzzing, we notice that
hp2xxmay sometimes have difficulty in exiting.I am not sure what additional "checks" could be reasonably added to "validate" HPGL input files prior to handing responsiblity for software which does have intimate knowledge of HPGL parsing. The actual problem here appears to be with hp2xx.
Unfortunately, hp2xx is unmaintained since 2003 and so it is unlikely to fare well in today's world of software fuzzing. Are there any fuzzing efforts for hp2xx and a set of effective patches for the problems found?
We currently request EPS output from hp2xx. EPS requires use of Ghostscript which has in recent years been noted to have serious security issues (e.g. execution of arbitrary shell commands and reading/writing arbitrary files) of a type which may or may not be fully addressed in the latest releases.
In some cases hp2xx supports SVG output. Unfortunately a quick test shows that the SVG output is somewhat defective and so it can't reasonably be used as a replacement for EPS.
I am testing under Ubuntu 18 and when using ImageMagick 6.9.7-4 I see that it tries to use a 'pcl6' external program, which I don't have, and don't know how to install. If it is doing something similar in your environment (and there is no 'pcl6' external program) then that would explain why ImageMagick quits immediately.
This issue is fixed by Mercurial changeset 16395:4fc18176a211. PCL files are no longer sent to the HPGL delegate.