fix: text_fast_path leakage between nested maps + release candid 0.10.29#732
Merged
Conversation
Click to see raw report |
There was a problem hiding this comment.
Pull request overview
Fixes a deserialization bug where the text_fast_path optimization for BTreeMap<String, V> could incorrectly affect nested map key decoding when the inner map’s key type is not Text, leading to a “Type mismatch” during enum key deserialization.
Changes:
- Track the string-key fast-path decision per map by adding
key_text_fasttoStyle::Map. - Update
MapAccess::next_key_seedto use the per-mapkey_text_fast(instead of the global flag) and to settext_fast_pathbased on the current map’s key type before key deserialization. - Add a regression test covering nested maps with a non-text (enum) key type.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| rust/candid/src/de.rs | Scopes text-key fast-path behavior per map to prevent leakage into nested map key decoding. |
| rust/candid/tests/serde.rs | Adds a regression test for nested map decoding where the inner map has a non-text enum key. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Bump `candid` and `candid_derive` 0.10.28 → 0.10.29 to ship the nested-map `text_fast_path` leakage fix, and add a 2026-05-27 CHANGELOG entry. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
lwshang
approved these changes
May 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix
text_fast_pathleaking from an outer text-keyed map into an inner map with non-text keys, which caused a spurious "Type mismatch" during decoding. Releases candid 0.10.29.