From 750239d9770b5ac47c9dcd878f01f9adaba89e1f Mon Sep 17 00:00:00 2001 From: Alex Sharov Date: Tue, 26 Oct 2021 14:29:18 +0700 Subject: [PATCH] more p2p fuzzing, part 2 (#132) --- txpool/packets.go | 4 ++-- ...80203b07f8c31d8fe5709ceebe1cc40a6a58ceafb2c03cb61f382ba47b | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) create mode 100644 txpool/testdata/fuzz/FuzzGetPooledTransactions66/35ee0280203b07f8c31d8fe5709ceebe1cc40a6a58ceafb2c03cb61f382ba47b diff --git a/txpool/packets.go b/txpool/packets.go index a2f23ed33..1295e21ed 100644 --- a/txpool/packets.go +++ b/txpool/packets.go @@ -97,7 +97,7 @@ func ParseGetPooledTransactions66(payload []byte, pos int, hashbuf []byte) (requ } hashes = common.EnsureEnoughSize(hashbuf, length.Hash*hashesCount) - for i := 0; pos < len(payload); i++ { + for i := 0; i < hashesCount; i++ { pos, err = rlp.ParseHash(payload, pos, hashes[i*length.Hash:]) if err != nil { return 0, hashes, 0, err @@ -114,7 +114,7 @@ func ParseGetPooledTransactions65(payload []byte, pos int, hashbuf []byte) (hash } hashes = common.EnsureEnoughSize(hashbuf, length.Hash*hashesCount) - for i := 0; pos < len(payload); i++ { + for i := 0; i < hashesCount; i++ { pos, err = rlp.ParseHash(payload, pos, hashes[i*length.Hash:]) if err != nil { return hashes, 0, err diff --git a/txpool/testdata/fuzz/FuzzGetPooledTransactions66/35ee0280203b07f8c31d8fe5709ceebe1cc40a6a58ceafb2c03cb61f382ba47b b/txpool/testdata/fuzz/FuzzGetPooledTransactions66/35ee0280203b07f8c31d8fe5709ceebe1cc40a6a58ceafb2c03cb61f382ba47b new file mode 100644 index 000000000..bd42d90cc --- /dev/null +++ b/txpool/testdata/fuzz/FuzzGetPooledTransactions66/35ee0280203b07f8c31d8fe5709ceebe1cc40a6a58ceafb2c03cb61f382ba47b @@ -0,0 +1,2 @@ +go test fuzz v1 +[]byte("\xe6\x83\x06\xf8T\xe1\xa0Y^'\xa85\xcdyr\x9f\x00\x80\xac\xec1\x87\xd4S_\xfc\xee\xee\xb6\xed\x14d\xa0N\xc7'\xaa\xca\xe1\xa0Y^'\xa85\xcdyr\x9f\x00\x80\xac\xec1\x87\xd4S_\xfc\xee\xeesN\xad\x96\xd8q\x8d\x03\xab\xc5\xfc\x13(")