honggfuzz_fuzz = ["honggfuzz"]
[dependencies]
+afl = { version = "0.3", optional = true }
lightning = { path = "..", features = ["fuzztarget"] }
bitcoin = { version = "0.13", features = ["fuzztarget"] }
-secp256k1 = { version = "0.9", features=["fuzztarget"] }
-rust-crypto = "0.2"
+hex = "0.3.2"
honggfuzz = { version = "0.5", optional = true }
-afl = { version = "0.3", optional = true }
+rust-crypto = "0.2"
+secp256k1 = { version = "0.9", features=["fuzztarget"] }
[build-dependencies]
cc = "1.0"
}
}
+extern crate hex;
#[cfg(test)]
mod tests {
- fn extend_vec_from_hex(hex: &str, out: &mut Vec<u8>) {
- let mut b = 0;
- for (idx, c) in hex.as_bytes().iter().enumerate() {
- b <<= 4;
- match *c {
- b'A'...b'F' => b |= c - b'A' + 10,
- b'a'...b'f' => b |= c - b'a' + 10,
- b'0'...b'9' => b |= c - b'0',
- _ => panic!("Bad hex"),
- }
- if (idx & 1) == 1 {
- out.push(b);
- b = 0;
- }
- }
- }
#[test]
fn duplicate_crash() {
- let mut a = Vec::new();
- extend_vec_from_hex("00", &mut a);
- super::do_test(&a);
+ super::do_test(&::hex::decode("00").unwrap());
}
}
}
}
+extern crate hex;
#[cfg(test)]
mod tests {
- fn extend_vec_from_hex(hex: &str, out: &mut Vec<u8>) {
- let mut b = 0;
- for (idx, c) in hex.as_bytes().iter().enumerate() {
- b <<= 4;
- match *c {
- b'A'...b'F' => b |= c - b'A' + 10,
- b'a'...b'f' => b |= c - b'a' + 10,
- b'0'...b'9' => b |= c - b'0',
- _ => panic!("Bad hex"),
- }
- if (idx & 1) == 1 {
- out.push(b);
- b = 0;
- }
- }
- }
-
#[test]
fn duplicate_crash() {
- let mut a = Vec::new();
- extend_vec_from_hex("00", &mut a);
- super::do_test(&a);
+ super::do_test(&::hex::decode("00").unwrap());
}
}
}
}
+extern crate hex;
#[cfg(test)]
mod tests {
- fn extend_vec_from_hex(hex: &str, out: &mut Vec<u8>) {
- let mut b = 0;
- for (idx, c) in hex.as_bytes().iter().enumerate() {
- b <<= 4;
- match *c {
- b'A'...b'F' => b |= c - b'A' + 10,
- b'a'...b'f' => b |= c - b'a' + 10,
- b'0'...b'9' => b |= c - b'0',
- _ => panic!("Bad hex"),
- }
- if (idx & 1) == 1 {
- out.push(b);
- b = 0;
- }
- }
- }
-
#[test]
fn duplicate_crash() {
- let mut a = Vec::new();
- extend_vec_from_hex("00", &mut a);
- super::do_test(&a);
+ super::do_test(&::hex::decode("00").unwrap());
}
}
}
}
+extern crate hex;
#[cfg(test)]
mod tests {
- fn extend_vec_from_hex(hex: &str, out: &mut Vec<u8>) {
- let mut b = 0;
- for (idx, c) in hex.as_bytes().iter().enumerate() {
- b <<= 4;
- match *c {
- b'A'...b'F' => b |= c - b'A' + 10,
- b'a'...b'f' => b |= c - b'a' + 10,
- b'0'...b'9' => b |= c - b'0',
- _ => panic!("Bad hex"),
- }
- if (idx & 1) == 1 {
- out.push(b);
- b = 0;
- }
- }
- }
-
#[test]
fn duplicate_crash() {
- let mut a = Vec::new();
- extend_vec_from_hex("00", &mut a);
- super::do_test(&a);
+ super::do_test(&::hex::decode("00").unwrap());
}
}
}
}
+extern crate hex;
#[cfg(test)]
mod tests {
- fn extend_vec_from_hex(hex: &str, out: &mut Vec<u8>) {
- let mut b = 0;
- for (idx, c) in hex.as_bytes().iter().enumerate() {
- b <<= 4;
- match *c {
- b'A'...b'F' => b |= c - b'A' + 10,
- b'a'...b'f' => b |= c - b'a' + 10,
- b'0'...b'9' => b |= c - b'0',
- _ => panic!("Bad hex"),
- }
- if (idx & 1) == 1 {
- out.push(b);
- b = 0;
- }
- }
- }
-
#[test]
fn duplicate_crash() {
- let mut a = Vec::new();
- extend_vec_from_hex("00", &mut a);
- super::do_test(&a);
+ super::do_test(&::hex::decode("00").unwrap());
}
}
}
}
+extern crate hex;
#[cfg(test)]
mod tests {
- use utils::extend_vec_from_hex;
#[test]
fn duplicate_crash() {
- let mut a = Vec::new();
- extend_vec_from_hex("00", &mut a);
- super::do_test(&a);
+ super::do_test(&::hex::decode("00").unwrap());
}
}
}
}
+extern crate hex;
#[cfg(test)]
mod tests {
- use utils::extend_vec_from_hex;
#[test]
fn duplicate_crash() {
- let mut a = Vec::new();
- extend_vec_from_hex("00", &mut a);
- super::do_test(&a);
+ super::do_test(&::hex::decode("00").unwrap());
}
}
}
}
+extern crate hex;
#[cfg(test)]
mod tests {
- use utils::extend_vec_from_hex;
#[test]
fn duplicate_crash() {
- let mut a = Vec::new();
- extend_vec_from_hex("00", &mut a);
- super::do_test(&a);
+ super::do_test(&::hex::decode("00").unwrap());
}
}
}
}
+extern crate hex;
#[cfg(test)]
mod tests {
- use utils::extend_vec_from_hex;
#[test]
fn duplicate_crash() {
- let mut a = Vec::new();
- extend_vec_from_hex("00", &mut a);
- super::do_test(&a);
+ super::do_test(&::hex::decode("00").unwrap());
}
}
}
}
+extern crate hex;
#[cfg(test)]
mod tests {
- use utils::extend_vec_from_hex;
#[test]
fn duplicate_crash() {
- let mut a = Vec::new();
- extend_vec_from_hex("00", &mut a);
- super::do_test(&a);
+ super::do_test(&::hex::decode("00").unwrap());
}
}
}
}
+extern crate hex;
#[cfg(test)]
mod tests {
- use utils::extend_vec_from_hex;
#[test]
fn duplicate_crash() {
- let mut a = Vec::new();
- extend_vec_from_hex("00", &mut a);
- super::do_test(&a);
+ super::do_test(&::hex::decode("00").unwrap());
}
}
}
}
+extern crate hex;
#[cfg(test)]
mod tests {
- use utils::extend_vec_from_hex;
#[test]
fn duplicate_crash() {
- let mut a = Vec::new();
- extend_vec_from_hex("00", &mut a);
- super::do_test(&a);
+ super::do_test(&::hex::decode("00").unwrap());
}
}
}
}
+extern crate hex;
#[cfg(test)]
mod tests {
- use utils::extend_vec_from_hex;
#[test]
fn duplicate_crash() {
- let mut a = Vec::new();
- extend_vec_from_hex("00", &mut a);
- super::do_test(&a);
+ super::do_test(&::hex::decode("00").unwrap());
}
}
}
}
+extern crate hex;
#[cfg(test)]
mod tests {
- use utils::extend_vec_from_hex;
#[test]
fn duplicate_crash() {
- let mut a = Vec::new();
- extend_vec_from_hex("00", &mut a);
- super::do_test(&a);
+ super::do_test(&::hex::decode("00").unwrap());
}
}
}
}
+extern crate hex;
#[cfg(test)]
mod tests {
- use utils::extend_vec_from_hex;
#[test]
fn duplicate_crash() {
- let mut a = Vec::new();
- extend_vec_from_hex("00", &mut a);
- super::do_test(&a);
+ super::do_test(&::hex::decode("00").unwrap());
}
}
}
}
+extern crate hex;
#[cfg(test)]
mod tests {
- use utils::extend_vec_from_hex;
#[test]
fn duplicate_crash() {
- let mut a = Vec::new();
- extend_vec_from_hex("00", &mut a);
- super::do_test(&a);
+ super::do_test(&::hex::decode("00").unwrap());
}
}
}
}
+extern crate hex;
#[cfg(test)]
mod tests {
- use utils::extend_vec_from_hex;
#[test]
fn duplicate_crash() {
- let mut a = Vec::new();
- extend_vec_from_hex("00", &mut a);
- super::do_test(&a);
+ super::do_test(&::hex::decode("00").unwrap());
}
}
}
}
+extern crate hex;
#[cfg(test)]
mod tests {
- use utils::extend_vec_from_hex;
#[test]
fn duplicate_crash() {
- let mut a = Vec::new();
- extend_vec_from_hex("00", &mut a);
- super::do_test(&a);
+ super::do_test(&::hex::decode("00").unwrap());
}
}
}
}
+extern crate hex;
#[cfg(test)]
mod tests {
- use utils::extend_vec_from_hex;
#[test]
fn duplicate_crash() {
- let mut a = Vec::new();
- extend_vec_from_hex("00", &mut a);
- super::do_test(&a);
+ super::do_test(&::hex::decode("00").unwrap());
}
}
}
}
+extern crate hex;
#[cfg(test)]
mod tests {
- use utils::extend_vec_from_hex;
#[test]
fn duplicate_crash() {
- let mut a = Vec::new();
- extend_vec_from_hex("00", &mut a);
- super::do_test(&a);
+ super::do_test(&::hex::decode("00").unwrap());
}
}
}
}
+extern crate hex;
#[cfg(test)]
mod tests {
- use utils::extend_vec_from_hex;
#[test]
fn duplicate_crash() {
- let mut a = Vec::new();
- extend_vec_from_hex("00", &mut a);
- super::do_test(&a);
+ super::do_test(&::hex::decode("00").unwrap());
}
}
}
}
+extern crate hex;
#[cfg(test)]
mod tests {
- use utils::extend_vec_from_hex;
#[test]
fn duplicate_crash() {
- let mut a = Vec::new();
- extend_vec_from_hex("00", &mut a);
- super::do_test(&a);
+ super::do_test(&::hex::decode("00").unwrap());
}
}
}
}
}
-
-#[allow(dead_code)]
-#[cfg(test)]
-pub fn extend_vec_from_hex(hex: &str, out: &mut Vec<u8>) {
- let mut b = 0;
- for (idx, c) in hex.as_bytes().iter().enumerate() {
- b <<= 4;
- match *c {
- b'A'...b'F' => b |= c - b'A' + 10,
- b'a'...b'f' => b |= c - b'a' + 10,
- b'0'...b'9' => b |= c - b'0',
- _ => panic!("Bad hex"),
- }
- if (idx & 1) == 1 {
- out.push(b);
- b = 0;
- }
- }
-}
}
}
+extern crate hex;
#[cfg(test)]
mod tests {
- fn extend_vec_from_hex(hex: &str, out: &mut Vec<u8>) {
- let mut b = 0;
- for (idx, c) in hex.as_bytes().iter().enumerate() {
- b <<= 4;
- match *c {
- b'A'...b'F' => b |= c - b'A' + 10,
- b'a'...b'f' => b |= c - b'a' + 10,
- b'0'...b'9' => b |= c - b'0',
- _ => panic!("Bad hex"),
- }
- if (idx & 1) == 1 {
- out.push(b);
- b = 0;
- }
- }
- }
#[test]
fn duplicate_crash() {
- let mut a = Vec::new();
- extend_vec_from_hex("01", &mut a);
- super::do_test(&a);
+ super::do_test(&::hex::decode("01").unwrap());
}
}
}
}
+extern crate hex;
#[cfg(test)]
mod tests {
- fn extend_vec_from_hex(hex: &str, out: &mut Vec<u8>) {
- let mut b = 0;
- for (idx, c) in hex.as_bytes().iter().enumerate() {
- b <<= 4;
- match *c {
- b'A'...b'F' => b |= c - b'A' + 10,
- b'a'...b'f' => b |= c - b'a' + 10,
- b'0'...b'9' => b |= c - b'0',
- _ => panic!("Bad hex"),
- }
- if (idx & 1) == 1 {
- out.push(b);
- b = 0;
- }
- }
- }
#[test]
fn duplicate_crash() {
- let mut a = Vec::new();
- extend_vec_from_hex("00", &mut a);
- super::do_test(&a);
+ super::do_test(&::hex::decode("00").unwrap());
}
}