You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- readLenPrefixedU16 wire length vs re-encoded length diverges on malformed UTF-8 (replacement char U+FFFD re-encodes to 3 bytes per invalid sequence)
2770
+
- Node.js writeUInt16BE already throws RangeError for >0xFFFF but error message is opaque — explicit guard gives clearer diagnostics
2771
+
- FNV-1a over charCodeAt gives different results from FNV-1a over UTF-8 bytes for any non-ASCII string — always hash bytes for cross-language compatibility
2772
+
---
2773
+
2774
+
## 2026-03-19 - US-070
2775
+
- Fixed overflow guards in Rust IPC binary encoder to prevent silent truncation
2776
+
- `write_session_id` now returns `io::Result<()>` and rejects session IDs > 255 bytes
2777
+
- `write_len_prefixed_u16` now returns `io::Result<()>` and rejects strings > 65535 bytes
2778
+
- `encode_body` changed to return `io::Result<()>` to propagate errors from helpers
2779
+
- Execute frame's `file_path` now uses `write_len_prefixed_u16` instead of inline `as u16` cast
2780
+
- All inline `as u16` casts for StreamEvent, BridgeCall, StreamCallback replaced with `write_len_prefixed_u16`
2781
+
- Removed dead `serialize_v8_args` function from bridge.rs (replaced by `serialize_v8_args_into`)
- encode_body was infallible (returned nothing) so callers like encode_frame_into had to handle errors only from the size check — now encode_body itself can fail on field overflow
2786
+
- All u16/u8 truncation points in encode_body now use the guarded helper functions
Copy file name to clipboardExpand all lines: scripts/ralph/prd.json
+4-4Lines changed: 4 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -1005,8 +1005,8 @@
1005
1005
"Tests pass"
1006
1006
],
1007
1007
"priority": 59,
1008
-
"passes": false,
1009
-
"notes": "PR review finding: Critical correctness bugs. readLenPrefixedU16 diverges on malformed UTF-8. fnv1aHash mismatch can cause stale bridge code on Rust side."
1008
+
"passes": true,
1009
+
"notes": "Fixed: readLenPrefixedU16 returns bytesRead from wire length instead of re-encoded string length; encodeSessionId throws on >255 bytes; writeLenPrefixedU16 throws on >65535 bytes; fnv1aHash hashes over UTF-8 bytes via Buffer.from()."
0 commit comments