From bd5442ed8de49b3a32930ef532c46fcc824f025e Mon Sep 17 00:00:00 2001 From: jidicula Date: Mon, 4 Oct 2021 21:29:58 -0400 Subject: [PATCH] fix(comment test): Fail if US 0x1f char is found Partially resolves: pelletier/go-toml#613 --- scanner.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scanner.go b/scanner.go index d0b4886a..bd36c11d 100644 --- a/scanner.go +++ b/scanner.go @@ -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 }