Skip to content

Commit

Permalink
Check trailing string
Browse files Browse the repository at this point in the history
  • Loading branch information
viirya committed Feb 14, 2024
1 parent c22e5cd commit ebe2b58
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion arrow-cast/src/parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,12 @@ macro_rules! parser_primitive {
($t:ty) => {
impl Parser for $t {
fn parse(string: &str) -> Option<Self::Native> {
atoi::atoi::<Self::Native>(string.as_bytes())
match atoi::FromRadix10SignedChecked::from_radix_10_signed_checked(
string.as_bytes(),
) {
(Some(n), x) if x == string.len() => Some(n),
_ => None,
}
}
}
};
Expand Down

0 comments on commit ebe2b58

Please sign in to comment.