managed-commons / SvgNet

Fork of the SVG library for .NET that makes a GdiGraphics that "draws" on a SVG model
BSD 3-Clause "New" or "Revised" License
84 stars 37 forks source link

DrawImage StackOverflow exception #14

Closed Keex0r closed 6 years ago

Keex0r commented 6 years ago

Hello, one of the DrawImage overloads in SVGGraphics.cs is causing a StackOverflow exception:

The culprit is (line 1656):

    /// <summary>
    /// Implemented
    /// </summary>
    public void DrawImage(Image image, Int32 x, Int32 y, Int32 width, Int32 height)
    {
        DrawImage(image, x, y, width, height);
    }

It misses type conversion of the parameter and hence calls itself recursively. A fix would be to add the typecasting to call the correct base overload:

    /// <summary>
    /// Implemented
    /// </summary>
    public void DrawImage(Image image, Int32 x, Int32 y, Int32 width, Int32 height)
    {
        DrawImage(image, (Single)x, (Single)y, (Single)width, (Single)height);
    }

Best regards Jens

monoman commented 6 years ago

Thanks for the report @Keex0r

monoman commented 6 years ago

Published nuget 1.0.6 with this fix : https://www.nuget.org/packages/SvgNet/1.0.6