You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While both serialisation and deserialisation workds fine if Maps and Sets are only used on top level, the deserialisation throws when they are nested in other objects.
const{ desia, sia, DeSia, Sia }=require('sializer');letobj=newMap();letbuf=sia(obj);obj=desia(buf);//fineobj={k: newMap()};buf=sia(obj);obj=desia(buf);//throws string "Key of type 57 is invalid."
This bug is apparently already fixed in the fork by @c7x43t, but that fork does not yet have TypeScript support.
As far as I can tell, the Problem is simply that this.offset in the Deserialiser is not incremented at the end of
to skip over the SIA_TYPES.mapEnd byte, which is not incremented over before, because it might be the start of the next block. So adding this.offset++; before the return fixes it.
I tried this fix locally for both Map and Set and confirmed that deserialisation works as expected then.
The text was updated successfully, but these errors were encountered:
While both serialisation and deserialisation workds fine if Maps and Sets are only used on top level, the deserialisation throws when they are nested in other objects.
This bug is apparently already fixed in the fork by @c7x43t, but that fork does not yet have TypeScript support.
As far as I can tell, the Problem is simply that
this.offset
in the Deserialiser is not incremented at the end ofto skip over the
SIA_TYPES.mapEnd
byte, which is not incremented over before, because it might be the start of the next block. So addingthis.offset++;
before the return fixes it.I tried this fix locally for both Map and Set and confirmed that deserialisation works as expected then.
The text was updated successfully, but these errors were encountered: