Source
Adversarial Phase 1 type-design audit (H3).
Problem
BlockBoundsKind payload (observed: u64, limit: u64) is comparator-direction-blind, encoding a hidden bidirectional contract:
StartOverlapsHeader: emitted when abs_start < payload_start → observed=abs_start, limit=payload_start (limit is lower bound, not upper)
EndPastFileSize: emitted when abs_end > file_size → observed=abs_end, limit=file_size (limit is upper bound)
limit means opposite things in the two variants. A consumer writing if observed > limit { ... } is wrong half the time. OffsetPastFileSize's sibling at error.rs:644-660 got the same shape but with both subkinds being upper bounds (>= and > — both upper), so it got away with it; this one didn't.
Fix
Either:
- Rename to
bound: BlockBoundsBound carrying Lower(u64) | Upper(u64), OR
- Split the
(observed, limit) into per-variant fields with directional names (block_start, payload_start_min, block_end, file_size_max).
Files
crates/paksmith-core/src/error.rs:665-676
crates/paksmith-core/src/container/pak/mod.rs:687-705, 1184-1203 (call sites)
crates/paksmith-core/src/error.rs:1000-1008 (Display impl)
Source
Adversarial Phase 1 type-design audit (H3).
Problem
BlockBoundsKindpayload(observed: u64, limit: u64)is comparator-direction-blind, encoding a hidden bidirectional contract:StartOverlapsHeader: emitted whenabs_start < payload_start→observed=abs_start,limit=payload_start(limit is lower bound, not upper)EndPastFileSize: emitted whenabs_end > file_size→observed=abs_end,limit=file_size(limit is upper bound)limitmeans opposite things in the two variants. A consumer writingif observed > limit { ... }is wrong half the time.OffsetPastFileSize's sibling aterror.rs:644-660got the same shape but with both subkinds being upper bounds (>=and>— both upper), so it got away with it; this one didn't.Fix
Either:
bound: BlockBoundsBoundcarryingLower(u64) | Upper(u64), OR(observed, limit)into per-variant fields with directional names (block_start,payload_start_min,block_end,file_size_max).Files
crates/paksmith-core/src/error.rs:665-676crates/paksmith-core/src/container/pak/mod.rs:687-705, 1184-1203(call sites)crates/paksmith-core/src/error.rs:1000-1008(Display impl)