Skip to content

Commit

Permalink
Add test for string slicing panic from issue 1010
Browse files Browse the repository at this point in the history
  • Loading branch information
pitdicker authored and djc committed Apr 18, 2023
1 parent a50648d commit 93e2a91
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/format/parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -997,3 +997,11 @@ fn test_rfc3339() {
}
}
}

#[cfg(test)]
#[test]
fn test_issue_1010() {
let dt = crate::NaiveDateTime::parse_from_str("\u{c}SUN\u{e}\u{3000}\0m@J\u{3000}\0\u{3000}\0m\u{c}!\u{c}\u{b}\u{c}\u{c}\u{c}\u{c}%A\u{c}\u{b}\0SU\u{c}\u{c}",
"\u{c}\u{c}%A\u{c}\u{b}\0SUN\u{c}\u{c}\u{c}SUNN\u{c}\u{c}\u{c}SUN\u{c}\u{c}!\u{c}\u{b}\u{c}\u{c}\u{c}\u{c}%A\u{c}\u{b}%a");
assert_eq!(dt, Err(ParseError(ParseErrorKind::Invalid)));
}

0 comments on commit 93e2a91

Please sign in to comment.