From fa6fe8e9cce16e59d3b0fe97c95c1e59c0d07c54 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Fri, 20 Feb 2026 21:12:25 +0900 Subject: fix: reject raw bytes less than 0x20 in string --- src/lib.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/lib.rs b/src/lib.rs index ed0da37..e5b9d58 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -326,6 +326,10 @@ impl<'input, 'output, I: ByteStream, W: Write> Parser<'input, 'output, I, W> { b'\\' => { self.walk_escape()?; } + c if c < 0x20 => { + // A raw byte less than 0x20 cannot be embedded in string. + return Err(SyntaxError::InvalidValue.into()); + } c => { self.output.write_all(&[c])?; } -- cgit v1.3-1-g0d28