Skip to content

Commit

Permalink
Comment about safe JSON string escape checking
Browse files Browse the repository at this point in the history
  • Loading branch information
zargony committed Oct 11, 2024
1 parent 4c87538 commit 9c31ee6
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions firmware/src/json/reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,8 @@ impl<R: BufRead> Reader<R> {
let mut buf = Vec::new();
loop {
match self.peek().await? {
// This is safe to check, even in the middle of a UTF-8 character since UTF-8
// guarantees that no character encoding is a substring of any other character
b'\\' => {
self.consume();
let ch = self.peek().await?;
Expand Down

0 comments on commit 9c31ee6

Please sign in to comment.