Skip to content
This repository has been archived by the owner on Mar 25, 2024. It is now read-only.

Commit

Permalink
Treat YAML 1.1 style octals with sign as string, not base 10 number
Browse files Browse the repository at this point in the history
  • Loading branch information
dtolnay committed Dec 13, 2021
1 parent f424a15 commit 57f2e66
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/de.rs
Expand Up @@ -987,7 +987,10 @@ where
return visitor.visit_i64(n);
}
}
if v.len() > 1 && v.starts_with('0') && v.bytes().all(|b| b.is_ascii_digit()) {
if {
let v = v.trim_start_matches(&['-', '+'][..]);
v.len() > 1 && v.starts_with('0') && v[1..].bytes().all(|b| b.is_ascii_digit())
} {
// After handling the different number encodings above if we are left
// with leading zero(s) followed by numeric characters this is in fact a
// string according to the YAML 1.2 spec.
Expand Down

0 comments on commit 57f2e66

Please sign in to comment.