fuzz: run 'cargo fmt' on all the fuzz targets
This commit is contained in:
parent
9cfc0fcd81
commit
6e2ee5be66
|
@ -1,8 +1,8 @@
|
|||
|
||||
use honggfuzz::fuzz;
|
||||
|
||||
fn do_test(data: &[u8]) {
|
||||
let _: Result<bitcoin::network::message::RawNetworkMessage, _> = bitcoin::consensus::encode::deserialize(data);
|
||||
let _: Result<bitcoin::network::message::RawNetworkMessage, _> =
|
||||
bitcoin::consensus::encode::deserialize(data);
|
||||
}
|
||||
|
||||
fn main() {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use std::str::FromStr;
|
||||
|
||||
use honggfuzz::fuzz;
|
||||
use std::str::FromStr;
|
||||
|
||||
fn do_test(data: &[u8]) {
|
||||
let data_str = String::from_utf8_lossy(data);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use std::str::FromStr;
|
||||
|
||||
use honggfuzz::fuzz;
|
||||
use std::str::FromStr;
|
||||
|
||||
fn do_test(data: &[u8]) {
|
||||
let data_str = String::from_utf8_lossy(data);
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
|
||||
use honggfuzz::fuzz;
|
||||
|
||||
fn do_test(data: &[u8]) {
|
||||
let _: Result<bitcoin::blockdata::block::Block, _>= bitcoin::consensus::encode::deserialize(data);
|
||||
let _: Result<bitcoin::blockdata::block::Block, _> =
|
||||
bitcoin::consensus::encode::deserialize(data);
|
||||
}
|
||||
|
||||
fn main() {
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
|
||||
use honggfuzz::fuzz;
|
||||
|
||||
fn do_test(data: &[u8]) {
|
||||
// We already fuzz Transactions in `./deserialize_transaction.rs`.
|
||||
let tx_result: Result<bitcoin::bip152::PrefilledTransaction, _> = bitcoin::consensus::encode::deserialize(data);
|
||||
let tx_result: Result<bitcoin::bip152::PrefilledTransaction, _> =
|
||||
bitcoin::consensus::encode::deserialize(data);
|
||||
|
||||
match tx_result {
|
||||
Err(_) => {},
|
||||
Err(_) => {}
|
||||
Ok(tx) => {
|
||||
let ser = bitcoin::consensus::encode::serialize(&tx);
|
||||
assert_eq!(&ser[..], data);
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
|
||||
use honggfuzz::fuzz;
|
||||
|
||||
fn do_test(data: &[u8]) {
|
||||
let psbt: Result<bitcoin::psbt::PartiallySignedTransaction, _> = bitcoin::psbt::Psbt::deserialize(data);
|
||||
let psbt: Result<bitcoin::psbt::PartiallySignedTransaction, _> =
|
||||
bitcoin::psbt::Psbt::deserialize(data);
|
||||
match psbt {
|
||||
Err(_) => {},
|
||||
Err(_) => {}
|
||||
Ok(psbt) => {
|
||||
let ser = bitcoin::psbt::Psbt::serialize(&psbt);
|
||||
let deser = bitcoin::psbt::Psbt::deserialize(&ser).unwrap();
|
||||
|
|
|
@ -1,10 +1,8 @@
|
|||
|
||||
use honggfuzz::fuzz;
|
||||
|
||||
use bitcoin::address::Address;
|
||||
use bitcoin::network::constants::Network;
|
||||
use bitcoin::blockdata::script;
|
||||
use bitcoin::consensus::encode;
|
||||
use bitcoin::network::constants::Network;
|
||||
use honggfuzz::fuzz;
|
||||
|
||||
fn do_test(data: &[u8]) {
|
||||
let s: Result<script::ScriptBuf, _> = encode::deserialize(data);
|
||||
|
@ -17,7 +15,9 @@ fn do_test(data: &[u8]) {
|
|||
return;
|
||||
}
|
||||
match ins.ok().unwrap() {
|
||||
script::Instruction::Op(op) => { b = b.push_opcode(op); }
|
||||
script::Instruction::Op(op) => {
|
||||
b = b.push_opcode(op);
|
||||
}
|
||||
script::Instruction::PushBytes(bytes) => {
|
||||
// Any one-byte pushes, except -0, which can be interpreted as numbers, should be
|
||||
// reserialized as numbers. (For -1 through 16, this will use special ops; for
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
|
||||
use honggfuzz::fuzz;
|
||||
|
||||
fn do_test(data: &[u8]) {
|
||||
let tx_result: Result<bitcoin::blockdata::transaction::Transaction, _> = bitcoin::consensus::encode::deserialize(data);
|
||||
let tx_result: Result<bitcoin::blockdata::transaction::Transaction, _> =
|
||||
bitcoin::consensus::encode::deserialize(data);
|
||||
match tx_result {
|
||||
Err(_) => {},
|
||||
Err(_) => {}
|
||||
Ok(mut tx) => {
|
||||
let ser = bitcoin::consensus::encode::serialize(&tx);
|
||||
assert_eq!(&ser[..], data);
|
||||
|
@ -22,7 +22,7 @@ fn do_test(data: &[u8]) {
|
|||
} else {
|
||||
assert_eq!(no_witness_len * 3 + len, calculated_weight);
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
|
||||
use honggfuzz::fuzz;
|
||||
|
||||
use bitcoin::consensus::{serialize, deserialize};
|
||||
use bitcoin::blockdata::witness::Witness;
|
||||
use bitcoin::consensus::{deserialize, serialize};
|
||||
use honggfuzz::fuzz;
|
||||
|
||||
fn do_test(data: &[u8]) {
|
||||
let w: Result<Witness, _> = deserialize(data);
|
||||
|
|
|
@ -1,21 +1,22 @@
|
|||
|
||||
use honggfuzz::fuzz;
|
||||
use std::str::FromStr;
|
||||
|
||||
use bitcoin::blockdata::transaction::OutPoint;
|
||||
use bitcoin::consensus::encode;
|
||||
|
||||
use std::str::FromStr;
|
||||
use honggfuzz::fuzz;
|
||||
|
||||
fn do_test(data: &[u8]) {
|
||||
let lowercase: Vec<u8> = data.iter().map(|c| match *c {
|
||||
let lowercase: Vec<u8> = data
|
||||
.iter()
|
||||
.map(|c| match *c {
|
||||
b'A' => b'a',
|
||||
b'B' => b'b',
|
||||
b'C' => b'c',
|
||||
b'D' => b'd',
|
||||
b'E' => b'e',
|
||||
b'F' => b'f',
|
||||
x => x
|
||||
}).collect();
|
||||
x => x,
|
||||
})
|
||||
.collect();
|
||||
let data_str = match String::from_utf8(lowercase) {
|
||||
Err(_) => return,
|
||||
Ok(s) => s,
|
||||
|
@ -33,7 +34,7 @@ fn do_test(data: &[u8]) {
|
|||
let string = deser.to_string();
|
||||
match OutPoint::from_str(&string) {
|
||||
Ok(destring) => assert_eq!(destring, deser),
|
||||
Err(_) => panic!()
|
||||
Err(_) => panic!(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,18 +1,14 @@
|
|||
use std::fmt;
|
||||
|
||||
use honggfuzz::fuzz;
|
||||
use std::fmt;
|
||||
|
||||
// faster than String, we don't need to actually produce the value, just check absence of panics
|
||||
struct NullWriter;
|
||||
|
||||
impl fmt::Write for NullWriter {
|
||||
fn write_str(&mut self, _s: &str) -> fmt::Result {
|
||||
Ok(())
|
||||
}
|
||||
fn write_str(&mut self, _s: &str) -> fmt::Result { Ok(()) }
|
||||
|
||||
fn write_char(&mut self, _c: char) -> fmt::Result {
|
||||
Ok(())
|
||||
}
|
||||
fn write_char(&mut self, _c: char) -> fmt::Result { Ok(()) }
|
||||
}
|
||||
|
||||
fn do_test(data: &[u8]) {
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
|
||||
use bitcoin::hashes::Hmac;
|
||||
use bitcoin::hashes::{sha1, sha512, ripemd160, sha256d};
|
||||
use bitcoin::hashes::{ripemd160, sha1, sha256d, sha512, Hmac};
|
||||
use honggfuzz::fuzz;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
|
||||
use bitcoin::hashes::Hmac;
|
||||
use bitcoin::hashes::{sha1, sha512, ripemd160, sha256d};
|
||||
use bitcoin::hashes::{ripemd160, sha1, sha256d, sha512, Hmac};
|
||||
use honggfuzz::fuzz;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
|
||||
use bitcoin::hashes::Hash;
|
||||
use bitcoin::hashes::ripemd160;
|
||||
use bitcoin::hashes::{ripemd160, Hash};
|
||||
use crypto::digest::Digest;
|
||||
use crypto::ripemd160::Ripemd160;
|
||||
use honggfuzz::fuzz;
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
|
||||
use bitcoin::hashes::Hash;
|
||||
use bitcoin::hashes::sha1;
|
||||
use bitcoin::hashes::{sha1, Hash};
|
||||
use crypto::digest::Digest;
|
||||
use crypto::sha1::Sha1;
|
||||
use honggfuzz::fuzz;
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
|
||||
use bitcoin::hashes::Hash;
|
||||
use bitcoin::hashes::sha256;
|
||||
use bitcoin::hashes::{sha256, Hash};
|
||||
use crypto::digest::Digest;
|
||||
use crypto::sha2::Sha256;
|
||||
use honggfuzz::fuzz;
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
|
||||
use bitcoin::hashes::Hash;
|
||||
use bitcoin::hashes::sha512;
|
||||
use bitcoin::hashes::{sha512, Hash};
|
||||
use crypto::digest::Digest;
|
||||
use crypto::sha2::Sha512;
|
||||
use honggfuzz::fuzz;
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
|
||||
use bitcoin::hashes::Hash;
|
||||
use bitcoin::hashes::sha512_256;
|
||||
use bitcoin::hashes::{sha512_256, Hash};
|
||||
use crypto::digest::Digest;
|
||||
use crypto::sha2::Sha512Trunc256;
|
||||
use honggfuzz::fuzz;
|
||||
|
|
Loading…
Reference in New Issue