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

Function TestReadLatin1_OOM_Bug

go/fory/string_test.go:93–103  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

91}
92
93func TestReadLatin1_OOM_Bug(t *testing.T) {
94 // We claim a massive size of 10,000 bytes, but provide an empty buffer.
95 buf := NewByteBuffer(nil)
96
97 err := &Error{}
98 // readLatin1 doesn't read the length itself, it takes it as an argument
99 result := readLatin1(buf, 10000, err)
100
101 require.True(t, err.HasError(), "Expected an error due to out of bounds buffer")
102 require.Equal(t, "", result, "Expected an empty string due to missing data")
103}

Callers

nothing calls this directly

Calls 4

HasErrorMethod · 0.95
NewByteBufferFunction · 0.85
readLatin1Function · 0.85
EqualMethod · 0.45

Tested by

no test coverage detected