diff --git a/types/reflect.go b/types/reflect.go index def5567..83f9c89 100644 --- a/types/reflect.go +++ b/types/reflect.go @@ -23,13 +23,9 @@ func deserializeType(d *Deserializer) reflect.Type { func serializeAny(s *Serializer, t reflect.Type, p unsafe.Pointer) { if serde, ok := s.serdes.serdeOf(t); ok { offset := len(s.b) - s.b = append(s.b, 0, 0, 0, 0) // store a 32-bit size placeholder + s.b = append(s.b, 0, 0, 0, 0, 0, 0, 0, 0) // store a 64-bit size placeholder serde.ser(s, t, p) - size := len(s.b) - offset - if int64(size) > math.MaxUint32 { - panic("overflow") - } - binary.LittleEndian.PutUint32(s.b[offset:], uint32(size)) + binary.LittleEndian.PutUint64(s.b[offset:], uint64(len(s.b)-offset)) return } @@ -102,7 +98,7 @@ func serializeAny(s *Serializer, t reflect.Type, p unsafe.Pointer) { func deserializeAny(d *Deserializer, t reflect.Type, p unsafe.Pointer) { if serde, ok := d.serdes.serdeOf(t); ok { - d.b = d.b[4:] // skip size prefix + d.b = d.b[8:] // skip size prefix serde.des(d, t, p) return }