Skip to content

edit: read bin-typed map keys - #454

Merged
philhofer merged 1 commit into
tinylib:masterfrom
youdie006:edit-bin-keys
Oct 16, 2026
Merged

philhofer merged 1 commit into
tinylib:masterfrom
youdie006:edit-bin-keys

Conversation

@youdie006

Copy link
Copy Markdown
Contributor

HasKey, locate and locateKV in msgp/edit.go read map keys with ReadStringZC, so a key encoded as bin stops the scan: Locate, HasKey, Replace, CopyReplace and Remove miss every field at or after it. The README says the deserializers accept bin map keys, and #450 switched ReadMapStrIntf for the same reason. This uses ReadMapKeyZC, like ReadMapStrIntfBytes.

TestEditBinKeys writes a map whose first key is bin and checks Locate/HasKey for both keys and a missing one, CopyReplace and Remove. It fails on master.

Written with AI assistance (Claude); I have reviewed the change.

HasKey, locate and locateKV read keys with ReadStringZC, so a key
encoded as bin stopped the scan. Use ReadMapKeyZC, as
ReadMapStrIntfBytes does.
@philhofer
philhofer merged commit e89371e into tinylib:master Oct 16, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants