Repository navigation
Commit 6c5c4f6
committed
fix(codex): saturate the derived token total
`unwrap_or` evaluates its argument eagerly, so the sum was computed even when a
recorded total was preserved. A corrupt or hostile log carrying two near-`u64`
component values would then panic under the checked arithmetic of a debug build
and wrap in release. Defer the sum and saturate it.
Also pin the preservation branch properly. The recorded total in
`keeps_a_recorded_total` was `input + output`, so the test passed whether the
value was preserved or re-derived. Use a total that cannot be derived.
Raised by CodeRabbit on #1499.1 parent a991ca8 commit 6c5c4f6
1 file changed
Lines changed: 18 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
294 | 294 | | |
295 | 295 | | |
296 | 296 | | |
297 | | - | |
| 297 | + | |
298 | 298 | | |
299 | 299 | | |
300 | 300 | | |
| |||
517 | 517 | | |
518 | 518 | | |
519 | 519 | | |
| 520 | + | |
| 521 | + | |
520 | 522 | | |
521 | 523 | | |
522 | 524 | | |
523 | 525 | | |
524 | 526 | | |
525 | | - | |
| 527 | + | |
526 | 528 | | |
527 | 529 | | |
528 | 530 | | |
529 | 531 | | |
530 | | - | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
531 | 546 | | |
532 | 547 | | |
533 | 548 | | |
| |||
0 commit comments