mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
tests/fuzzers: fixup
This commit is contained in:
parent
82be956663
commit
ec354fd258
6 changed files with 93 additions and 36 deletions
|
|
@ -4,34 +4,33 @@ base: ubuntu:16.04
|
||||||
targets:
|
targets:
|
||||||
- name: rlp
|
- name: rlp
|
||||||
language: go
|
language: go
|
||||||
version: "1.11"
|
version: "1.13"
|
||||||
corpus: ./fuzzers/rlp/corpus
|
corpus: ./fuzzers/rlp/corpus
|
||||||
harness:
|
harness:
|
||||||
function: Fuzz
|
function: Fuzz
|
||||||
package: github.com/ethereum/go-ethereum/fuzzers/rlp
|
package: github.com/ethereum/go-ethereum/tests/fuzzers/rlp
|
||||||
checkout: github.com/ethereum/go-ethereum/
|
checkout: github.com/ethereum/go-ethereum/
|
||||||
- name: keystore
|
- name: keystore
|
||||||
language: go
|
language: go
|
||||||
version: "1.11"
|
version: "1.13"
|
||||||
corpus: ./fuzzers/keystore/corpus
|
corpus: ./fuzzers/keystore/corpus
|
||||||
harness:
|
harness:
|
||||||
function: Fuzz
|
function: Fuzz
|
||||||
package: github.com/ethereum/go-ethereum/fuzzers/keystore
|
package: github.com/ethereum/go-ethereum/tests/fuzzers/keystore
|
||||||
checkout: github.com/ethereum/go-ethereum/
|
checkout: github.com/ethereum/go-ethereum/
|
||||||
- name: trie
|
- name: trie
|
||||||
language: go
|
language: go
|
||||||
version: "1.11"
|
version: "1.13"
|
||||||
corpus: ./fuzzers/trie/corpus
|
corpus: ./fuzzers/trie/corpus
|
||||||
harness:
|
harness:
|
||||||
function: Fuzz
|
function: Fuzz
|
||||||
package: github.com/ethereum/go-ethereum/fuzzers/trie
|
package: github.com/ethereum/go-ethereum/tests/fuzzers/trie
|
||||||
checkout: github.com/ethereum/go-ethereum/
|
checkout: github.com/ethereum/go-ethereum/
|
||||||
- name: whisperv6
|
- name: whisperv6
|
||||||
language: go
|
language: go
|
||||||
version: "1.11"
|
version: "1.13"
|
||||||
corpus: ./fuzzers/whisperv6/corpus
|
corpus: ./fuzzers/whisperv6/corpus
|
||||||
harness:
|
harness:
|
||||||
function: Fuzz
|
function: Fuzz
|
||||||
package: github.com/ethereum/go-ethereum/fuzzers/whisperv6
|
package: github.com/ethereum/go-ethereum/tests/fuzzers/whisperv6
|
||||||
checkout: github.com/ethereum/go-ethereum/
|
checkout: github.com/ethereum/go-ethereum/
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,22 +0,0 @@
|
||||||
package keystore
|
|
||||||
|
|
||||||
import (
|
|
||||||
"os"
|
|
||||||
|
|
||||||
"github.com/ethereum/go-ethereum/accounts/keystore"
|
|
||||||
)
|
|
||||||
|
|
||||||
func Fuzz(input []byte) int {
|
|
||||||
|
|
||||||
ks := keystore.NewKeyStore("/tmp/ks", keystore.LightScryptN, keystore.LightScryptP)
|
|
||||||
|
|
||||||
a, err := ks.NewAccount(string(input))
|
|
||||||
if err != nil {
|
|
||||||
panic(err)
|
|
||||||
}
|
|
||||||
if err := ks.Unlock(a, string(input)); err != nil {
|
|
||||||
panic(err)
|
|
||||||
}
|
|
||||||
os.Remove(a.URL.Path)
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
37
tests/fuzzers/keystore/keystore-fuzzer.go
Normal file
37
tests/fuzzers/keystore/keystore-fuzzer.go
Normal file
|
|
@ -0,0 +1,37 @@
|
||||||
|
// Copyright 2019 The go-ethereum Authors
|
||||||
|
// This file is part of the go-ethereum library.
|
||||||
|
//
|
||||||
|
// The go-ethereum library is free software: you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
// the Free Software Foundation, either version 3 of the License, or
|
||||||
|
// (at your option) any later version.
|
||||||
|
//
|
||||||
|
// The go-ethereum library is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
// GNU Lesser General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU Lesser General Public License
|
||||||
|
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
package keystore
|
||||||
|
|
||||||
|
import (
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"github.com/ethereum/go-ethereum/accounts/keystore"
|
||||||
|
)
|
||||||
|
|
||||||
|
func Fuzz(input []byte) int {
|
||||||
|
ks := keystore.NewKeyStore("/tmp/ks", keystore.LightScryptN, keystore.LightScryptP)
|
||||||
|
|
||||||
|
a, err := ks.NewAccount(string(input))
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
if err := ks.Unlock(a, string(input)); err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
os.Remove(a.URL.Path)
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
@ -1,3 +1,19 @@
|
||||||
|
// Copyright 2019 The go-ethereum Authors
|
||||||
|
// This file is part of the go-ethereum library.
|
||||||
|
//
|
||||||
|
// The go-ethereum library is free software: you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
// the Free Software Foundation, either version 3 of the License, or
|
||||||
|
// (at your option) any later version.
|
||||||
|
//
|
||||||
|
// The go-ethereum library is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
// GNU Lesser General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU Lesser General Public License
|
||||||
|
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
package rlp
|
package rlp
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
|
@ -21,7 +37,6 @@ func decodeEncode(input []byte, val interface{}, i int) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func Fuzz(input []byte) int {
|
func Fuzz(input []byte) int {
|
||||||
|
|
||||||
var i int
|
var i int
|
||||||
{
|
{
|
||||||
if len(input) > 0 {
|
if len(input) > 0 {
|
||||||
|
|
@ -107,8 +122,6 @@ func Fuzz(input []byte) int {
|
||||||
i++
|
i++
|
||||||
var rs types.Receipts
|
var rs types.Receipts
|
||||||
decodeEncode(input, &rs, i)
|
decodeEncode(input, &rs, i)
|
||||||
i++
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,19 @@
|
||||||
|
// Copyright 2019 The go-ethereum Authors
|
||||||
|
// This file is part of the go-ethereum library.
|
||||||
|
//
|
||||||
|
// The go-ethereum library is free software: you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
// the Free Software Foundation, either version 3 of the License, or
|
||||||
|
// (at your option) any later version.
|
||||||
|
//
|
||||||
|
// The go-ethereum library is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
// GNU Lesser General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU Lesser General Public License
|
||||||
|
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
package trie
|
package trie
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,19 @@
|
||||||
|
// Copyright 2019 The go-ethereum Authors
|
||||||
|
// This file is part of the go-ethereum library.
|
||||||
|
//
|
||||||
|
// The go-ethereum library is free software: you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
// the Free Software Foundation, either version 3 of the License, or
|
||||||
|
// (at your option) any later version.
|
||||||
|
//
|
||||||
|
// The go-ethereum library is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
// GNU Lesser General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU Lesser General Public License
|
||||||
|
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
package whisperv6
|
package whisperv6
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
|
@ -60,7 +76,6 @@ func Fuzz(input []byte) int {
|
||||||
}
|
}
|
||||||
if !decrypted.ValidateAndParse() {
|
if !decrypted.ValidateAndParse() {
|
||||||
panic("ValidateAndParse failed")
|
panic("ValidateAndParse failed")
|
||||||
return 0
|
|
||||||
}
|
}
|
||||||
if !bytes.Equal(text, decrypted.Payload) {
|
if !bytes.Equal(text, decrypted.Payload) {
|
||||||
panic("text != decrypted.Payload")
|
panic("text != decrypted.Payload")
|
||||||
|
|
@ -71,6 +86,5 @@ func Fuzz(input []byte) int {
|
||||||
if !whisperv6.IsPubKeyEqual(decrypted.Src, ¶ms.Src.PublicKey) {
|
if !whisperv6.IsPubKeyEqual(decrypted.Src, ¶ms.Src.PublicKey) {
|
||||||
panic("Unexpected public key")
|
panic("Unexpected public key")
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue