MCPcopy
hub / github.com/golang/protobuf / TestLengthOverflow

Function TestLengthOverflow

proto/proto_test.go:1486–1494  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1484}
1485
1486func TestLengthOverflow(t *testing.T) {
1487 // Overflowing a length should not panic.
1488 b := protopack.Message{
1489 protopack.Tag{2, protopack.BytesType}, protopack.String("\x01"),
1490 protopack.Tag{3, protopack.BytesType}, protopack.Uvarint(9223372036854775807),
1491 protopack.Raw("\x01"),
1492 }.Marshal()
1493 proto.Unmarshal(b, new(pb2.MyMessage))
1494}
1495
1496func TestVarintOverflow(t *testing.T) {
1497 // Overflowing a 64-bit length should not be allowed.

Callers

nothing calls this directly

Calls 3

UnmarshalFunction · 0.92
MarshalMethod · 0.65
StringMethod · 0.45

Tested by

no test coverage detected