Skip to content

Commit

Permalink
fix: return error when prev_idx > end_idx
Browse files Browse the repository at this point in the history
  • Loading branch information
cardigan1008 authored and ChristopherRabotin committed Apr 6, 2024
1 parent 93639d5 commit 54a9ef8
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/epoch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1050,6 +1050,10 @@ impl Epoch {
idx + 1
};

if prev_idx > end_idx {
return Err(Errors::ParseError(ParsingErrors::ISO8601));
}

match lexical_core::parse(s[prev_idx..end_idx].as_bytes()) {
Ok(val) => {
// Check that this valid is OK for the token we're reading it as.
Expand Down

0 comments on commit 54a9ef8

Please sign in to comment.