MCPcopy Create free account
hub / github.com/apache/fory / TestReadVarUint32RejectsOverflowFifthByte

Function TestReadVarUint32RejectsOverflowFifthByte

go/fory/buffer_test.go:116–126  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

114}
115
116func TestReadVarUint32RejectsOverflowFifthByte(t *testing.T) {
117 for _, data := range [][]byte{
118 {0x80, 0x80, 0x80, 0x80, 0x10},
119 {0x80, 0x80, 0x80, 0x80, 0x10, 0, 0, 0},
120 } {
121 buf := NewByteBuffer(data)
122 var err Error
123 _ = buf.ReadVarUint32(&err)
124 require.True(t, err.HasError(), "expected overflow error for %v", data)
125 }
126}
127
128func TestStreamSkipDoesNotGrowToSkippedLength(t *testing.T) {
129 err := &Error{}

Callers

nothing calls this directly

Calls 3

ReadVarUint32Method · 0.95
HasErrorMethod · 0.95
NewByteBufferFunction · 0.85

Tested by

no test coverage detected