map.js triggers assertion when encountering an integer-keyed map with key 0 #27
Labels
bug
Something isn't working
help wanted
Extra attention is needed
javascript
port-fix
triaged
Issue has been triaged
Version: 3.12.2
Language: Javascript
Following is a base64 string of bytes that has been coded from C# side. I could immediately decode at C# side just fine, but it failed to decode at JS library.
It is coming from this proto definition. Please ignore references to other unknown messages, because the problem is on just field index 11.
This is a
ToString
of real data coming from C#. Many were default, so it seems they had been efficiently stripped off.When trying to deserialize in JS :
It produces assertion failure :
When compared with original source code, this assertion should be line 507 in
js/map.js
,jspb.Map.deserializeBinary
:goog.asserts.assert(key != undefined);
The key and value is going to be used in themap.set
that follows so two asserts are there.The problematic part in the data is the field index 11,
map<int32,CharacterConfiguration> character_configurations = 11;
It is an int mapped to an another message. In the bytes, it has 2 members, int 0 mapped to an empty message, and int 1 mapped to a message with a bit of string data. Again, this is what they are at C#'s
ToString
debug :By simply removing the 0 keyed entry with default message value, and add it back to be keyed with 2 instead :
JS is able to deserialize without triggering the assertion error. It seems like there is something with integer key at number 0. (C# could deserialize 0-keyed map in the protobuf bytes just fine)
The text was updated successfully, but these errors were encountered: