Decode masgpack hash key values as byte

This commit is contained in:
shortcutme 2019-03-16 04:22:49 +01:00
parent c7b4e28f82
commit 6e5bf5fef6
No known key found for this signature in database
GPG key ID: 5B63BAE6CB9613AE

View file

@ -65,7 +65,7 @@ def objectDecoderHook(obj):
for key, val in obj:
if type(key) is bytes:
key = key.decode("utf8")
if key in bin_value_keys or type(val) is not bytes:
if key in bin_value_keys or type(val) is not bytes or len(key) >= 64:
back[key] = val
else:
back[key] = val.decode("utf8")
@ -100,4 +100,4 @@ def numUnprocessedBytes(unpacker):
num_bytes = unpacker_bytes - unpacker.tell()
else:
num_bytes = unpacker._fb_buf_n - unpacker._fb_buf_o
return num_bytes
return num_bytes