fix(candid): bound length-prefixed allocations in header parser + release candid 0.10.35 - #758
Conversation
…ease 0.10.35 Length-prefixed byte fields in the type-table parser (a future type's payload, a service method's name) now grow their buffer incrementally instead of reserving the declared length up front, so an out-of-range or truncated length surfaces as an ordinary parse error. Wire format and decoder error behaviour are unchanged. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
✅ No security or compliance issues detected. Reviewed everything up to f28574a. Security Overview
Detected Code Changes
|
Valid messages decode identically, but the error returned for a truncated byte field changes representation; drop the broader "decoder error behaviour unchanged" claim to avoid overstating compatibility. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
marc0olo
left a comment
There was a problem hiding this comment.
Re-reviewed at f28574a. LGTM.
Checked the parser change against the binrw 0.15.2 internals it relies on, and confirmed the other length-prefixed read sites in binary_parser.rs behave correctly and need no equivalent change. The chunk size lines up with what Take::read_to_end reserves internally, so buffer growth stays linear. Loop termination and the short-read condition are correct.
Release hygiene is consistent: candid and candid_derive both to 0.10.35, the =0.10.35 pin matches, both Cargo.locks updated, and candid_parser's caret dependency correctly needs no bump. cargo test -p candid is green locally, and the new tests fail without the parser change.
The follow-up commit is CHANGELOG-only with no code delta, and the reworded compatibility note reads accurately now.
Non-blocking, pre-existing, worth a separate issue: the remaining #[br(count = len)] sites narrow a u64 wire length to usize. This PR keeps u64 end-to-end in the two fields it touches; the rest could be tidied up later.
Patch release. Bounds allocation for length-prefixed fields in the type-table header parser. See CHANGELOG.
🤖 Generated with Claude Code