| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Decoder#clone() is used for re-entrant decoding (e.g. an extension codec that decodes nested MessagePack on the same Decoder instance, issue msgpack#195). It copied every decoder option except mapKeyConverter, so any map decoded re-entrantly silently fell back to the default key converter instead of the one the caller configured. Copy mapKeyConverter in clone() alongside the other options, and add a regression test that decodes a nested map through an extension codec.
| Back | FazBrowse Home | New Git URL |
Problem
Decoder#clone() is used for re-entrant decoding — for example an extension codec that decodes nested MessagePack on the same reusable Decoder instance (the pattern from #195). clone() copies every decoder option except mapKeyConverter, so any map decoded re-entrantly silently falls back to the default key converter instead of the one the caller configured.
Repro (converter upper-cases keys; extension type 1 re-enters the same decoder):
Fix
Copy mapKeyConverter in clone() alongside the other options (keyDecoder and the max* limits are already copied). One line, plus a regression test that decodes a nested map through an extension codec.
Full suite: 328 passing; lint and typecheck clean.