blob: unaligned UTF-16LE decode for odd-length/odd-address views#31006
Closed
alii wants to merge 13 commits into
Closed
blob: unaligned UTF-16LE decode for odd-length/odd-address views#31006alii wants to merge 13 commits into
alii wants to merge 13 commits into
Claude / Claude Code Review
completed
May 18, 2026 in 13m 14s
Code review found 1 important issue
Found 6 candidates, confirmed 2. See review comments for details.
Details
| Severity | Count |
|---|---|
| 🔴 Important | 1 |
| 🟡 Nit | 1 |
| 🟣 Pre-existing | 0 |
| Severity | File:Line | Issue |
|---|---|---|
| 🔴 Important | src/runtime/webcore/Blob.rs:2671-2674 |
bytemuck::cast_slice still panics on misaligned buf from sliced Blobs |
| 🟡 Nit | test/js/web/fetch/blob.test.ts:346-350 |
Test pipes stderr but never reads or asserts on it |
Annotations
Check failure on line 2674 in src/runtime/webcore/Blob.rs
claude / Claude Code Review
bytemuck::cast_slice still panics on misaligned buf from sliced Blobs
`bytemuck::cast_slice::<u8, u16>` panics on two conditions — odd *length* and odd *alignment* — and this PR only fixes the first. `shared_view_raw()` returns `base + self.offset`, so e.g. `new Blob([Buffer.concat([Buffer.from([0x00, 0xFF, 0xFE]), Buffer.from('hi', 'utf16le')])]).slice(1).text()` hands an odd-address `buf` to `cast_slice`, which still aborts the process with `PodCastError::TargetAlignmentGreaterAndInputNotAligned` (the deleted comment even said "bytemuck checks align + even-len")
Check warning on line 350 in test/js/web/fetch/blob.test.ts
claude / Claude Code Review
Test pipes stderr but never reads or asserts on it
nit: `stderr: "pipe"` is set but `proc.stderr` is never read. Consider adding `proc.stderr.text()` to the `Promise.all` and asserting `expect(stderr).toBe("")` first (matching the neighboring `dupeWithContentType` test and the pattern in test/CLAUDE.md) so the panic message isn't swallowed if this ever regresses.
Loading