Skip to content

Commit

Permalink
Bugfix: SVG pathdata command with insufficient arguments panicked
Browse files Browse the repository at this point in the history
  • Loading branch information
tdewolff committed Nov 21, 2019
1 parent aa9bafa commit 75ac1f1
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion svg/pathdata.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ func (p *PathData) ShortenPathData(b []byte) []byte {
continue
} else if pathCmds[c] && (cmd == 0 || cmd != c || c == 'M' || c == 'm') { // any command
if cmd != 0 {
j += p.copyInstruction(b[j:], cmd)
j += p.copyInstruction(b[j:i], cmd)
} else {
j = i
}
Expand Down
1 change: 1 addition & 0 deletions svg/pathdata_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ func TestPathData(t *testing.T) {
"A.0.0.4.0.0.0.3.0.0.0.0.0.4.2.0.0.0.0.2.0.4.0.0.0.4.2.8.2.0.0.0.2.9.28.0.0.0.0.0.2.3.0.0.0.0.0.0.2.3.2.09e-03.0.0.0.0.8.0.0.0.0.0.0.0",
},
{"0z", "0z"},
{"0a0z", "0a0z"},
}

p := NewPathData(&Minifier{Decimals: -1})
Expand Down

0 comments on commit 75ac1f1

Please sign in to comment.