Commit c317041
committed
fix(pr-x1): two P2 codex findings on PR #167
1. array_chunks_checked: guard N == 0 before modulo
`data.len() % 0` would panic via `slice::as_chunks::<0>()` (and the
modulo itself). The strict-fallible contract folds N==0 into Err
so callers on the checked surface never see an unexpected panic.
New test `array_chunks_checked_rejects_zero_n` covers the edge.
2. Fingerprint<8>::as_u8x64: gate to target_endian = "little"
The pointer-reinterpret returns a native-endian view; on a BE
target the byte order would contradict the project-wide LE
convention used by Fingerprint::to_bytes / from_bytes (both
`u64::to_le_bytes` / `from_le_bytes`). `.cargo/config.toml` pins
`target-cpu=x86-64-v4` so all supported targets are LE in
practice — the cfg gate just makes the LE assumption explicit
instead of implicit. SAFETY comment item 6 now cites the gate.
The accompanying `pr_x1_as_u8x64_tests` module is gated to LE
to match.
Both fixes per codex review threads on PR #167.1 parent 6b52a46 commit c317041
2 files changed
Lines changed: 41 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
650 | 650 | | |
651 | 651 | | |
652 | 652 | | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
| 661 | + | |
| 662 | + | |
| 663 | + | |
| 664 | + | |
| 665 | + | |
653 | 666 | | |
654 | 667 | | |
655 | 668 | | |
| |||
679 | 692 | | |
680 | 693 | | |
681 | 694 | | |
| 695 | + | |
682 | 696 | | |
683 | 697 | | |
684 | 698 | | |
| |||
696 | 710 | | |
697 | 711 | | |
698 | 712 | | |
| 713 | + | |
| 714 | + | |
699 | 715 | | |
700 | 716 | | |
701 | 717 | | |
702 | 718 | | |
703 | 719 | | |
| 720 | + | |
704 | 721 | | |
705 | 722 | | |
706 | 723 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
337 | 337 | | |
338 | 338 | | |
339 | 339 | | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
340 | 347 | | |
341 | 348 | | |
342 | 349 | | |
| |||
347 | 354 | | |
348 | 355 | | |
349 | 356 | | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
350 | 360 | | |
351 | 361 | | |
352 | 362 | | |
353 | 363 | | |
354 | 364 | | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
355 | 370 | | |
356 | 371 | | |
357 | 372 | | |
| |||
401 | 416 | | |
402 | 417 | | |
403 | 418 | | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
404 | 428 | | |
0 commit comments