2
0

Fix encoding of a large composite data type

If encoding a field caused a buffer reallocation, the its length would be
written to a wrong place.
This commit is contained in:
Yaz Saito
2020-07-21 23:35:43 -07:00
parent 7a3e774a52
commit b939bc8d68
+1 -1
View File
@@ -576,7 +576,7 @@ func (b *CompositeBinaryBuilder) AppendEncoder(oid uint32, field BinaryEncoder)
return
}
if fieldBuf != nil {
binary.BigEndian.PutUint32(b.buf[lengthPos:], uint32(len(fieldBuf)-len(b.buf)))
binary.BigEndian.PutUint32(fieldBuf[lengthPos:], uint32(len(fieldBuf)-len(b.buf)))
b.buf = fieldBuf
}