Skip to content

Commit

Permalink
make NormalizeNewlines() return a copy (fixes #305)
Browse files Browse the repository at this point in the history
  • Loading branch information
kjk committed Mar 28, 2024
1 parent 1d8abb7 commit 8d53b25
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions parser/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -907,6 +907,9 @@ func isListItem(d ast.Node) bool {
}

func NormalizeNewlines(d []byte) []byte {
res := make([]byte, 0, len(d))
copy(res, d)
d = res
wi := 0
n := len(d)
for i := 0; i < n; i++ {
Expand Down

0 comments on commit 8d53b25

Please sign in to comment.