1
0
mirror of https://github.com/bspeice/dtparse synced 2025-07-03 14:54:57 -04:00

Add fuzzing, find and fix a parser bug.

This commit is contained in:
Mike Meehan
2018-07-18 22:27:29 -04:00
parent fecba852d1
commit ac95e9e8c3
5 changed files with 46 additions and 2 deletions

View File

@ -952,7 +952,11 @@ impl Parser {
if let Some(value) = info.get_month(&tokens[idx + 4]) {
ymd.append(value as i32, &tokens[idx + 4], Some(YMDLabel::Month))?;
} else {
ymd.append(tokens[idx + 4].parse::<i32>().unwrap(), &tokens[idx + 4], None)?;
if let Ok(val) = tokens[idx + 4].parse::<i32>() {
ymd.append(val, &tokens[idx + 4], None)?;
} else {
return Err(ParseInternalError::ValueError("".to_owned()));
}
}
idx += 2;