clarify offsets serialization, thanks @imnisen, fix #1963

This commit is contained in:
protolambda 2020-09-09 13:04:53 +02:00
parent 88cdc5bc80
commit 6c6f180e0e
No known key found for this signature in database
GPG Key ID: EC89FDBB2B4C7623

View File

@ -165,7 +165,7 @@ variable_lengths = [len(part) for part in variable_parts]
assert sum(fixed_lengths + variable_lengths) < 2**(BYTES_PER_LENGTH_OFFSET * BITS_PER_BYTE)
# Interleave offsets of variable-size parts with fixed-size parts
variable_offsets = [serialize(sum(fixed_lengths + variable_lengths[:i])) for i in range(len(value))]
variable_offsets = [serialize(uint32(sum(fixed_lengths + variable_lengths[:i]))) for i in range(len(value))]
fixed_parts = [part if part != None else variable_offsets[i] for i, part in enumerate(fixed_parts)]
# Return the concatenation of the fixed-size parts (offsets interleaved) with the variable-size parts