Skip to content

Commit

Permalink
awk: strings cannot contain '\0'
Browse files Browse the repository at this point in the history
  • Loading branch information
grisenti committed Sep 6, 2024
1 parent 61292dd commit 682f5b0
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions awk/src/compiler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,9 @@ fn parse_escape_sequence(iter: &mut Chars) -> Result<(char, Option<char>), Strin
}
}
}
if char_code == 0 {
return Err("invalid escape sequence: \\0".to_string());
}
// FIXME: I don't think this is correct. We should also consider multi-byte characters
char::from_u32(char_code).ok_or("invalid character")?
}
Expand Down

0 comments on commit 682f5b0

Please sign in to comment.