open-standards/wai/int-payload-conformance/refusals/wis1_unread_word.bin
Transaction Science ec9fc1c85b wai: integer payload streams must end canonically
An unread word after a rANS stream's last symbol, or a final state other
than 2^31, coded the same symbols in other bytes, so one decode could have
many content hashes.

- rans::RansDecoder::is_canonical_end: never ran out, every word read, and
  the state 2^31 an encoder starts from.
- Each stream of WIV1, WIH1 (both streams, nested ones included), WIA1 and
  WIS1 is checked after its last symbol; otherwise the payload is refused
  with the new code stream_noncanonical (Refusal::ALL is now 19 codes).
- Fixtures: an appended word under each format, a one-pixel WIV1 coded
  from the state 2^31 + 1 (its canonical twin, coded from 2^31, decodes
  to a grey pixel in both verifiers), and a one-frame keyframe-1 WIV1 whose
  empty residual stream is not the state 2^31 alone. The Python verifier
  checks the end of every stream it decodes.
- Every committed stream ends canonically; integer-payloads.md §2 and §8
  state the rule.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-01 19:18:08 -04:00

2.9 KiB