Skip to content

Commit 5a316b7

Browse files
author
Dan Laine
committed
reduce diff
1 parent 83fdfdc commit 5a316b7

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

x/merkledb/codec_test.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ package merkledb
55

66
import (
77
"bytes"
8+
"encoding/binary"
89
"io"
10+
"math"
911
"math/rand"
1012
"testing"
1113

@@ -243,3 +245,10 @@ func FuzzEncodeHashValues(f *testing.F) {
243245
},
244246
)
245247
}
248+
249+
func TestCodecDecodeKeyLengthOverflowRegression(t *testing.T) {
250+
codec := codec.(*codecImpl)
251+
bytes := bytes.NewReader(binary.AppendUvarint(nil, math.MaxInt))
252+
_, err := codec.decodeKey(bytes)
253+
require.ErrorIs(t, err, io.ErrUnexpectedEOF)
254+
}

0 commit comments

Comments
 (0)