Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Overflow error is thrown by SetPath method of SvgTextBase class #488

Closed
ojmoreno opened this issue Jun 14, 2019 · 0 comments · Fixed by #490
Closed

Overflow error is thrown by SetPath method of SvgTextBase class #488

ojmoreno opened this issue Jun 14, 2019 · 0 comments · Fixed by #490

Comments

@ojmoreno
Copy link

Overflow error is thrown by SetPath method of SvgTextBase class when a text element contains a tspan element to format it and it contains just one character. You can find the problem on following line:
https://github.com/vvvv/SVG/blob/43f5accbffdf156fd2aa052ac8522fd48551a3f3/Source/Text/SvgTextBase.cs#L371

The state.NumChars is 1 and the origState.NumChars is 0, so it cause that the origState.LetterSpacingAdjust contains an infinity value and it produces an overflow error. This problem doesn't happen when there are more than one character or there aren't tspan elements as content of the text element.
See following StackTrace:

   at System.Drawing.Graphics.CheckErrorStatus(Int32 status)
   at System.Drawing.Graphics.DrawPath(Pen pen, GraphicsPath path)
   at Svg.SvgRenderer.DrawPath(Pen pen, GraphicsPath path) in D:\Samples\SVG-nuget2.4.3\Source\Rendering\SvgRenderer.cs:line 76
   at Svg.SvgVisualElement.RenderStroke(ISvgRenderer renderer) in D:\Samples\SVG-nuget2.4.3\Source\Basic Shapes\SvgVisualElement.cs:line 343
   at Svg.SvgVisualElement.RenderFillAndStroke(ISvgRenderer renderer) in D:\Samples\SVG-nuget2.4.3\Source\Basic Shapes\SvgVisualElement.cs:line 216
   at Svg.SvgTextBase.Render(ISvgRenderer renderer) in D:\Samples\SVG-nuget2.4.3\Source\Text\SvgTextBase.cs:line 246
   at Svg.SvgElement.RenderChildren(ISvgRenderer renderer) in D:\Samples\SVG-nuget2.4.3\Source\SvgElement.cs:line 802
   at Svg.SvgTextBase.Render(ISvgRenderer renderer) in D:\Samples\SVG-nuget2.4.3\Source\Text\SvgTextBase.cs:line 247
   at Svg.SvgElement.RenderChildren(ISvgRenderer renderer) in D:\Samples\SVG-nuget2.4.3\Source\SvgElement.cs:line 802
   at Svg.SvgVisualElement.Render(ISvgRenderer renderer, Boolean renderFilter) in D:\Samples\SVG-nuget2.4.3\Source\Basic Shapes\SvgVisualElement.cs:line 168
   at Svg.SvgVisualElement.Render(ISvgRenderer renderer) in D:\Samples\SVG-nuget2.4.3\Source\Basic Shapes\SvgVisualElement.cs:line 129
   at Svg.SvgGroup.Render(ISvgRenderer renderer) in D:\Samples\SVG-nuget2.4.3\Source\Document Structure\SvgGroup.cs:line 55
   at Svg.SvgElement.RenderChildren(ISvgRenderer renderer) in D:\Samples\SVG-nuget2.4.3\Source\SvgElement.cs:line 802
   at Svg.SvgVisualElement.Render(ISvgRenderer renderer, Boolean renderFilter) in D:\Samples\SVG-nuget2.4.3\Source\Basic Shapes\SvgVisualElement.cs:line 168
   at Svg.SvgVisualElement.Render(ISvgRenderer renderer) in D:\Samples\SVG-nuget2.4.3\Source\Basic Shapes\SvgVisualElement.cs:line 129
   at Svg.SvgGroup.Render(ISvgRenderer renderer) in D:\Samples\SVG-nuget2.4.3\Source\Document Structure\SvgGroup.cs:line 55
   at Svg.SvgElement.RenderChildren(ISvgRenderer renderer) in D:\Samples\SVG-nuget2.4.3\Source\SvgElement.cs:line 802
   at Svg.SvgElement.Render(ISvgRenderer renderer) in D:\Samples\SVG-nuget2.4.3\Source\SvgElement.cs:line 790
   at Svg.SvgFragment.Render(ISvgRenderer renderer) in D:\Samples\SVG-nuget2.4.3\Source\Document Structure\SvgFragment.cs:line 169
   at Svg.SvgDocument.Draw(ISvgRenderer renderer, ISvgBoundable boundable) in D:\Samples\SVG-nuget2.4.3\Source\SvgDocument.cs:line 428
   at Svg.SvgDocument.Draw(Bitmap bitmap) in D:\Samples\SVG-nuget2.4.3\Source\SvgDocument.cs:line 526
   at Svg.SvgDocument.Draw() in D:\Samples\SVG-nuget2.4.3\Source\SvgDocument.cs:line 506
   at SVGViewer.SVGViewer.RenderSvg(SvgDocument svgDoc) in D:\Samples\SVG-nuget2.4.3\Samples\SVGViewer\SvgViewer.cs:line 73
   at SVGViewer.SVGViewer.open_Click(Object sender, EventArgs e) in D:\Samples\SVG-nuget2.4.3\Samples\SVGViewer\SvgViewer.cs:line 30

You can reproduce it with the SVGViewer application and the following attached files:
SVGs.zip

mrbean-bremen added a commit to mrbean-bremen/SVG that referenced this issue Jun 16, 2019
mrbean-bremen added a commit to mrbean-bremen/SVG that referenced this issue Jun 17, 2019
mrbean-bremen added a commit that referenced this issue Jun 17, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants