From 456b784f4ff742bf604340e62c11da47b46b2950 Mon Sep 17 00:00:00 2001 From: Rose Hogenson Date: Mon, 24 Nov 2025 17:43:44 -0800 Subject: Disallow control characters in strings --- ccl_test.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'ccl_test.go') diff --git a/ccl_test.go b/ccl_test.go index e377306..e7405f8 100644 --- a/ccl_test.go +++ b/ccl_test.go @@ -259,6 +259,14 @@ can just span multiple lines"`, desc: "StringOctal", msg: `string: '\033'`, want: message{String: "\033"}, + }, { + desc: "StringStripCarriageReturn", + msg: "string:'a\r\nb'", + want: message{String: "a\nb"}, + }, { + desc: "StringTab", + msg: "string:'\t'", + want: message{String: "\t"}, }, { desc: "Message", msg: `message { field: 10 }`, @@ -407,6 +415,12 @@ func TestUnmarshal_Invalid(t *testing.T) { }, { desc: "StringBadUnicode", msg: `string:"\ugggg"`, + }, { + desc: "StringControlCharacter", + msg: "string:'\a'", + }, { + desc: "StringCarriageReturnNotFollowedByNewline", + msg: "string:'\r'", }, { desc: "UnterminatedString", msg: `string: '`, -- cgit v1.3.1