Skip to content

Commit

Permalink
Ad missing check for index outside arrary (#892)
Browse files Browse the repository at this point in the history
* Fixes #888 'polyline draw error !Index was outside the bounds of the array' issue
* Add test
* Update ReleaseNotes.md
  • Loading branch information
H1Gdev committed Sep 4, 2021
1 parent 68ade05 commit a7088cf
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 3 deletions.
9 changes: 6 additions & 3 deletions Source/Basic Shapes/SvgMarkerElement.cs
Expand Up @@ -58,9 +58,12 @@ protected internal override bool RenderStroke(ISvgRenderer renderer)
{
++index;
}
var refPoint2 = path.PathPoints[index];
var marker = OwnerDocument.GetElementById<SvgMarker>(markerStart.ToString());
marker.RenderMarker(renderer, this, refPoint1, refPoint1, refPoint2, true);
if (index < pathLength)
{
var refPoint2 = path.PathPoints[index];
var marker = OwnerDocument.GetElementById<SvgMarker>(markerStart.ToString());
marker.RenderMarker(renderer, this, refPoint1, refPoint1, refPoint2, true);
}
}

var markerMid = MarkerMid.ReplaceWithNullIfNone();
Expand Down
1 change: 1 addition & 0 deletions Tests/Svg.UnitTests/PassingTests.csv
Expand Up @@ -243,6 +243,7 @@ __issue-769-01
__issue-785-01
__issue-863-01
__issue-886-01
__issue-888-01
__pull_request-373-01
__pull_request-374-01
__pull_request-414-01
Expand Down
1 change: 1 addition & 0 deletions Tests/W3CTestSuite/PassingTests.txt
Expand Up @@ -277,6 +277,7 @@ __issue-769-01.svg
__issue-785-01.svg
__issue-863-01.svg
__issue-886-01.svg
__issue-888-01.svg
__pull_request-373-01.svg
__pull_request-374-01.svg
__pull_request-414-01.svg
Expand Down
Binary file added Tests/W3CTestSuite/png/__issue-888-01.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 12 additions & 0 deletions Tests/W3CTestSuite/svg/__issue-888-01.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions doc/ReleaseNotes.md
Expand Up @@ -26,6 +26,7 @@ The release versions are NuGet releases.
* prevent `ISvgRenderer.SmoothingMode` reset when `RequiresSmoothRendering` is `true`
(see [#882](https://github.com/svg-net/SVG/issues/882))
* ignore `x` and `y` attributes in outermost svg as per standard (see [#886](https://github.com/svg-net/SVG/issues/886))
* fixed index is outside arrary boundary (see [#888](https://github.com/svg-net/SVG/issues/888))

## [Version 3.2.3](https://www.nuget.org/packages/Svg/3.2.3)

Expand Down

0 comments on commit a7088cf

Please sign in to comment.