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:
|
||||
- name: rlp
|
||||
language: go
|
||||
version: "1.11"
|
||||
version: "1.13"
|
||||
corpus: ./fuzzers/rlp/corpus
|
||||
harness:
|
||||
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/
|
||||
- name: keystore
|
||||
language: go
|
||||
version: "1.11"
|
||||
version: "1.13"
|
||||
corpus: ./fuzzers/keystore/corpus
|
||||
harness:
|
||||
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/
|
||||
- name: trie
|
||||
language: go
|
||||
version: "1.11"
|
||||
version: "1.13"
|
||||
corpus: ./fuzzers/trie/corpus
|
||||
harness:
|
||||
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/
|
||||
- name: whisperv6
|
||||
language: go
|
||||
version: "1.11"
|
||||
version: "1.13"
|
||||
corpus: ./fuzzers/whisperv6/corpus
|
||||
harness:
|
||||
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/
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
import (
|
||||
|
|
@ -21,7 +37,6 @@ func decodeEncode(input []byte, val interface{}, i int) {
|
|||
}
|
||||
|
||||
func Fuzz(input []byte) int {
|
||||
|
||||
var i int
|
||||
{
|
||||
if len(input) > 0 {
|
||||
|
|
@ -107,8 +122,6 @@ func Fuzz(input []byte) int {
|
|||
i++
|
||||
var rs types.Receipts
|
||||
decodeEncode(input, &rs, i)
|
||||
i++
|
||||
}
|
||||
|
||||
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
|
||||
|
||||
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
|
||||
|
||||
import (
|
||||
|
|
@ -60,7 +76,6 @@ func Fuzz(input []byte) int {
|
|||
}
|
||||
if !decrypted.ValidateAndParse() {
|
||||
panic("ValidateAndParse failed")
|
||||
return 0
|
||||
}
|
||||
if !bytes.Equal(text, decrypted.Payload) {
|
||||
panic("text != decrypted.Payload")
|
||||
|
|
@ -71,6 +86,5 @@ func Fuzz(input []byte) int {
|
|||
if !whisperv6.IsPubKeyEqual(decrypted.Src, ¶ms.Src.PublicKey) {
|
||||
panic("Unexpected public key")
|
||||
}
|
||||
|
||||
return 0
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue