Commit 1037d48
🔒 Saturate timestamp nanosecond addition during entry parsing
Use `time::Duration::saturating_add` instead of `+` for ctime/mtime/atime
when combining seconds (cTIM/mTIM/aTIM) with nanoseconds (cTNS/mTNS/aTNS)
in `NormalEntry` parsing.
`time::Duration` panics on i64 second overflow, but the upstream `nanos()`
helper already rejects values `>= 1_000_000_000`, so the previous `+`
cannot actually panic for any archive that passes existing chunk
validation. The change is defense-in-depth: if `nanos()` is ever relaxed
or upstream `time::Duration` semantics change, the parser stays total
without introducing a new `InvalidData` error path that would reject
archives that decode cleanly today.
No behavior change for archives whose nanoseconds satisfy the existing
0..1_000_000_000 constraint.1 parent a84eadf commit 1037d48
1 file changed
Lines changed: 6 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
681 | 681 | | |
682 | 682 | | |
683 | 683 | | |
684 | | - | |
685 | | - | |
686 | | - | |
| 684 | + | |
| 685 | + | |
| 686 | + | |
| 687 | + | |
| 688 | + | |
| 689 | + | |
687 | 690 | | |
688 | 691 | | |
689 | 692 | | |
| |||
0 commit comments