Skip to content

Commit

Permalink
fix(comment test): Fail if US 0x1f char is found
Browse files Browse the repository at this point in the history
Oddly enough, the test passes when it shouldn't.

Partially resolves: pelletier#613
  • Loading branch information
jidicula committed Oct 5, 2021
1 parent 6bc6702 commit 1c407d1
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions scanner.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,9 @@ func scanComment(b []byte) ([]byte, []byte, error) {
if b[i] == 0x00 {
return b[:i], b[i:], newDecodeError(b[:i], "comments cannot include the 0x00 NUL character")
}
if b[i] == 0x1f {
return b[:i], b[i:], newDecodeError(b[:i], "comments cannot include the 0x1f US character")
}
if b[i] == '\n' {
return b[:i], b[i:], nil
}
Expand Down

0 comments on commit 1c407d1

Please sign in to comment.