aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/lib.rs
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-02-20 21:12:25 +0900
committernsfisis <nsfisis@gmail.com>2026-02-20 21:12:41 +0900
commitfa6fe8e9cce16e59d3b0fe97c95c1e59c0d07c54 (patch)
treea1656e41e0f77730178b0dd83084e25e3dfa465d /src/lib.rs
parent3eb2c98a1d7282a7904db5996aae3ef1a5da4b30 (diff)
downloadreparojson-fa6fe8e9cce16e59d3b0fe97c95c1e59c0d07c54.tar.gz
reparojson-fa6fe8e9cce16e59d3b0fe97c95c1e59c0d07c54.tar.zst
reparojson-fa6fe8e9cce16e59d3b0fe97c95c1e59c0d07c54.zip
fix: reject raw bytes less than 0x20 in string
Diffstat (limited to 'src/lib.rs')
-rw-r--r--src/lib.rs4
1 files changed, 4 insertions, 0 deletions
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])?;
}