Newer versions of GraphicsMagick fail to parse/convert an SVG image:
Revision tip aka 15649:8a7c195f1cbe:
./graphicsmagick-code/utilities/gm convert svgimg.svg svgimg.jpg ./graphicsmagick-code/utilities/gm convert: [No such file or directory].
The file svgimg.svg tested with is part of the sphinx test suite and can be found at:
https://github.com/sphinx-doc/sphinx/blob/c5257238075fa4fbcb774fd2905a502d88070d8c/tests/roots/test-ext-imgconverter/svgimg.svg
GraphicsMagick 1.3.26 does not have this problem, 1.3.27 and onwards do.
Some more infos:
I've used hg bisect between GraphicsMagick-1_3_27 and GraphicsMagick-1_3_26^2 and identified commit 15243:785758bbbfcc "DrawImage(): Fix pointer computation which leads to large strncpy size request and bad array index." as the first bad commit.
Also if I remove lines 50-52 in svgimg.svg, i.e. the second linearGradient definition
<linearGradient xlink:href="#linearGradient1160" id="linearGradient1163" />
then the SVG image is parsed and converted without error.
Diff:
I broke it so I should fix it. Changeset 785758bbbfcc "DrawImage(): Fix pointer computation which leads to large strncpy size request and bad array index." introduced wrong tests for arithmetic overflow.
The remedy for this problem is provided by Mercurial changeset 15651:4897d905117d. Thanks for the bug report.
Thanks for the quick response and fix! I can confirm that 15651:4897d905117d fixes the issue for me. Thanks again.
On Sat, 19 May 2018, Hsiu Vardaman wrote:
Unfortunately, going back to the original bug which resulted in the
fixes shows that these latest changes cause that bug to re-appear.
Bob
Please try again with Mercurial changeset 15653:432696c6a3f9. This one avoids the heap overflow encountered in issue 517 and appears to accept your input without an error.
Changeset 15653:432696c6a3f9 works for svgimg.svg of this issue. However, I think the file nested_clippaths.svg of bug #517 does not work
(unless this is the expected output). Versions 1.3.26 segfaults (as expected by bug #517) and 1.3.27 has the same output as the build of revision 15653:432696c6a3f9.
Hsiu
I don't know if the nested_clippaths.svg test case for #517 is supposed to work. The main concern was to avoid a heap overwrite with this test case.
Ok. So as far as I'm concerned this issue is fixed.
The reporter is now happy!