Commit 7e45551
Fix out-of-bounds read on short final chunk; harden example file read
Address two review findings:
- Slip::process_into_buffer copied `input_len`/`output_len` frames from
the input buffer, but validate_buffers only guarantees `frames_to_read`
frames are present. On a short final chunk (Indexing::partial_len set)
that read past the validated region. Copy only `frames_to_read` frames;
the remainder of the scratch is already zero-padded.
- The adjust_ratio_f64 example read samples with Read::read, which may
return a short read and decode a corrupt trailing sample from leftover
bytes. Use read_exact and stop on UnexpectedEof.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>1 parent e3fc87c commit 7e45551
2 files changed
Lines changed: 13 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
43 | | - | |
44 | | - | |
45 | | - | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
46 | 51 | | |
47 | | - | |
48 | | - | |
49 | 52 | | |
50 | 53 | | |
51 | 54 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
413 | 413 | | |
414 | 414 | | |
415 | 415 | | |
416 | | - | |
| 416 | + | |
| 417 | + | |
417 | 418 | | |
418 | 419 | | |
419 | 420 | | |
420 | | - | |
| 421 | + | |
421 | 422 | | |
422 | 423 | | |
423 | 424 | | |
| |||
426 | 427 | | |
427 | 428 | | |
428 | 429 | | |
| 430 | + | |
429 | 431 | | |
430 | 432 | | |
431 | 433 | | |
432 | | - | |
| 434 | + | |
433 | 435 | | |
434 | 436 | | |
435 | 437 | | |
| |||
0 commit comments