Commit ed6f3ba
committed
fix(codec): reject ANS streams with n>0 but an empty freq table
Codex P2: decode_modes accepted a stream whose header claimed n > 0 while
all four stored frequencies were zero (an "empty model"). from_freqs
permits an all-zero table for the n == 0 empty-stream case, so a corrupt
or non-encode_modes stream slipped through and rans_decode fabricated
Escape tags from the freq-0 table instead of reporting malformed input.
Add an explicit n > 0 / all-zero-table guard + regression test.
https://claude.ai/code/session_01HbqooFZHAjaUtFEzhA1R2u1 parent 347f36d commit ed6f3ba
1 file changed
Lines changed: 18 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
351 | 351 | | |
352 | 352 | | |
353 | 353 | | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
354 | 361 | | |
355 | 362 | | |
356 | 363 | | |
| |||
487 | 494 | | |
488 | 495 | | |
489 | 496 | | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
490 | 508 | | |
491 | 509 | | |
492 | 510 | | |
| |||
0 commit comments