mirror of
https://github.com/storytold/lightcraft.git
synced 2026-11-01 05:57:09 -06:00
Reject EXIF offsets beyond 18 hours
Found while testing crates/meta/src/datetime.rs:77 Co-Authored-By: GPT-6-Luna <noreply@openai.com>
This commit is contained in:
co-authored by
GPT-6-Luna
parent
59a5d00c60
commit
e981b25e06
@@ -74,7 +74,7 @@ impl DateTime {
|
||||
None if rest.len() == 4 => (num(rest.get(..2)?)?, num(rest.get(2..)?)?),
|
||||
None => (num(rest)?, 0),
|
||||
};
|
||||
if h > 18 || m > 59 {
|
||||
if h > 18 || m > 59 || (h == 18 && m > 0) {
|
||||
return None;
|
||||
}
|
||||
Some(sign * (h * 60 + m) as i16)
|
||||
@@ -185,6 +185,10 @@ mod tests {
|
||||
assert_eq!(DateTime::parse_offset("-05:30"), Some(-330));
|
||||
assert_eq!(DateTime::parse_offset("Z"), Some(0));
|
||||
assert_eq!(DateTime::parse_offset("+0930"), Some(570));
|
||||
assert_eq!(DateTime::parse_offset("+18:00"), Some(1080));
|
||||
assert_eq!(DateTime::parse_offset("-18:00"), Some(-1080));
|
||||
assert_eq!(DateTime::parse_offset("+18:01"), None);
|
||||
assert_eq!(DateTime::parse_offset("-18:01"), None);
|
||||
assert_eq!(DateTime::parse_offset(" : "), None);
|
||||
assert_eq!(DateTime::parse_offset("+99:00"), None);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user