Menu

#561 Parsing of SVG images fail with "Non-conforming drawing primitive definition (push)"

v1.0_(example)
closed-fixed
None
5
2018-05-31
2018-05-19
No

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.

Discussion

  • Bob Friesenhahn

    Bob Friesenhahn - 2018-05-19
    • assigned_to: Gregory J Wolfe
     
  • Bob Friesenhahn

    Bob Friesenhahn - 2018-05-19
    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -3,7 +3,7 @@
     Revision tip aka 15649:8a7c195f1cbe:
     ~~~
     ./graphicsmagick-code/utilities/gm convert svgimg.svg svgimg.jpg
    -./graphicsmagick-code/utilities/gm convert: Non-conforming drawing primitive definition (push) [No such file or directory].
    +./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:
    
    • assigned_to: Gregory J Wolfe --> Bob Friesenhahn
     
  • Bob Friesenhahn

    Bob Friesenhahn - 2018-05-19

    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.

     
  • Anonymous

    Anonymous - 2018-05-19

    Thanks for the quick response and fix! I can confirm that 15651:4897d905117d fixes the issue for me. Thanks again.

     
    • Bob Friesenhahn

      Bob Friesenhahn - 2018-05-19

      On Sat, 19 May 2018, Hsiu Vardaman wrote:

      Thanks for the quick response and fix! I can confirm that 15651:4897d905117d fixes the issue for me. Thanks again.

      Unfortunately, going back to the original bug which resulted in the
      fixes shows that these latest changes cause that bug to re-appear.

      Bob

       
  • Bob Friesenhahn

    Bob Friesenhahn - 2018-05-19

    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.

     
  • Anonymous

    Anonymous - 2018-05-19

    Changeset 15653:432696c6a3f9 works for svgimg.svg of this issue. However, I think the file nested_clippaths.svg of bug #517 does not work

     ./graphicsmagick-code/utilities/gm convert nested_clippaths.svg nested.jpg
    attribute not recognized: n
    attribute not recognized: u
    ./graphicsmagick-code/utilities/gm convert: text value does not convert to float (l)) [No such file or directory].
    

    (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

     
  • Bob Friesenhahn

    Bob Friesenhahn - 2018-05-19

    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.

     
  • Anonymous

    Anonymous - 2018-05-27

    Ok. So as far as I'm concerned this issue is fixed.

     
  • Bob Friesenhahn

    Bob Friesenhahn - 2018-05-31
    • status: open --> closed-fixed
     
  • Bob Friesenhahn

    Bob Friesenhahn - 2018-05-31

    The reporter is now happy!

     

Log in to post a comment.