Skip to content

Commit

Permalink
fix: loop issue triggered by unexpected escape sequences
Browse files Browse the repository at this point in the history
  • Loading branch information
chaika2013 authored and bzick committed Jan 22, 2025
1 parent 398be88 commit e35eb96
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
2 changes: 2 additions & 0 deletions token.go
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,8 @@ func (t *Token) ValueUnescaped() []byte {
result = append(result, str[:idx]...)
result = append(result, p...)
str = str[idx+len(p)+1:]
} else {
break
}
} else {
break
Expand Down
1 change: 1 addition & 0 deletions tokenizer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ func TestTokenize(t *testing.T) {
{"два три", Token{key: TokenString, string: quote, value: []byte("\"два три\"")}},
{"one\" two", Token{key: TokenString, string: quote, value: []byte(`"one\" two"`)}},
{"", Token{key: TokenString, string: quote, value: []byte("\"\"")}},
{`one\' two`, Token{key: TokenString, string: quote, value: []byte(`"one\' two"`)}},
}
for _, v := range framed {
stream := tokenizer.ParseBytes(v.token.value)
Expand Down

0 comments on commit e35eb96

Please sign in to comment.