fixed code style

This commit is contained in:
Dominik Maier 2021-04-26 19:01:24 +02:00
parent 86f62ef560
commit 77867306f2
4 changed files with 25 additions and 28 deletions

View File

@ -6,7 +6,7 @@ description = "Slot your own fuzzers together and extend their features using Ru
documentation = "https://docs.rs/libafl" documentation = "https://docs.rs/libafl"
repository = "https://github.com/AFLplusplus/LibAFL/" repository = "https://github.com/AFLplusplus/LibAFL/"
license = "MIT OR Apache-2.0" license = "MIT OR Apache-2.0"
keywords = ["fuzzing", "testing"] keywords = ["fuzzing", "testing", "security"]
edition = "2018" edition = "2018"
build = "build.rs" build = "build.rs"
@ -18,7 +18,6 @@ ahash = "0.6.1" # another hash
fxhash = "0.2.1" # yet another hash fxhash = "0.2.1" # yet another hash
xxhash-rust = { version = "0.8.0", features = ["const_xxh3", "xxh3"] } # xxh3 hashing for rust xxhash-rust = { version = "0.8.0", features = ["const_xxh3", "xxh3"] } # xxh3 hashing for rust
serde_json = "1.0.60" serde_json = "1.0.60"
num_cpus = "1.0" # cpu count, for llmp example num_cpus = "1.0" # cpu count, for llmp example
[[bench]] [[bench]]
@ -35,9 +34,9 @@ harness = false
#debug = true #debug = true
[features] [features]
default = ["std", "anymapdbg", "derive"] default = ["std", "anymap_debug", "derive"]
std = [] # print, sharedmap, ... support std = [] # print, sharedmap, ... support
anymapdbg = ["serde_json"] # uses serde_json to Debug the anymap trait. Disable for smaller footprint. anymap_debug = ["serde_json"] # uses serde_json to Debug the anymap trait. Disable for smaller footprint.
derive = ["libafl_derive"] # provide derive(SerdeAny) macro. derive = ["libafl_derive"] # provide derive(SerdeAny) macro.
llmp_small_maps = [] # reduces initial map size for llmp llmp_small_maps = [] # reduces initial map size for llmp
llmp_debug = [] # Enables debug output for LLMP llmp_debug = [] # Enables debug output for LLMP
@ -59,7 +58,6 @@ static_assertions = "1.1.0"
ctor = "*" ctor = "*"
libafl_derive = { version = "*", optional = true, path = "../libafl_derive" } libafl_derive = { version = "*", optional = true, path = "../libafl_derive" }
serde_json = { version = "1.0", optional = true, default-features = false, features = ["alloc"] } # an easy way to debug print SerdeAnyMap serde_json = { version = "1.0", optional = true, default-features = false, features = ["alloc"] } # an easy way to debug print SerdeAnyMap
#TODO: for llmp brotli = { version = "3.3.0", default-features = false } # brotli compression
num_enum = "0.5.1" num_enum = "0.5.1"
backtrace = "0.3" # for llmp_debug backtrace = "0.3" # for llmp_debug

View File

@ -5,9 +5,6 @@ use serde::{Deserialize, Deserializer, Serialize, Serializer};
use alloc::boxed::Box; use alloc::boxed::Box;
use core::any::{Any, TypeId}; use core::any::{Any, TypeId};
#[cfg(feature = "anymap_debug")]
use serde_json;
// yolo // yolo
pub fn pack_type_id(id: u64) -> TypeId { pub fn pack_type_id(id: u64) -> TypeId {
@ -181,15 +178,15 @@ macro_rules! create_serde_registry_for_trait {
} }
} }
#[cfg(fature = "anymapdbg")] #[cfg(feature = "anymap_debug")]
impl fmt::Debug for SerdeAnyMap { impl fmt::Debug for SerdeAnyMap {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
let json = serde_json::to_string(&self); let json = serde_json::to_string(&self);
write!(f, "SerdeAnyMap: [{}]", json) write!(f, "SerdeAnyMap: [{:?}]", json)
} }
} }
#[cfg(not(fature = "anymapdbg"))] #[cfg(not(feature = "anymap_debug"))]
impl fmt::Debug for SerdeAnyMap { impl fmt::Debug for SerdeAnyMap {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
write!(f, "SerdeAnymap with {} elements", self.len()) write!(f, "SerdeAnymap with {} elements", self.len())

View File

@ -8,24 +8,13 @@ use serde::{de::DeserializeOwned, Serialize};
use core::ptr::read_volatile; use core::ptr::read_volatile;
#[cfg(feature = "std")] #[cfg(feature = "std")]
use crate::bolts::llmp::LlmpReceiver; use crate::bolts::{
llmp::{LlmpClient, LlmpReceiver},
#[cfg(all(feature = "std", windows))] shmem::StdShMemProvider,
use crate::utils::startable_self; };
#[cfg(all(feature = "std", unix))]
use crate::utils::{fork, ForkResult};
#[cfg(all(feature = "std", unix))]
use crate::bolts::shmem::UnixShMemProvider;
#[cfg(all(feature = "std", target_os = "android"))]
use crate::bolts::os::ashmem_server::AshmemService;
#[cfg(feature = "std")]
use crate::bolts::shmem::StdShMemProvider;
use crate::{ use crate::{
bolts::{ bolts::{
llmp::{self, LlmpClient, LlmpClientDescription, LlmpSender, Tag}, llmp::{self, LlmpClientDescription, LlmpSender, Tag},
shmem::ShMemProvider, shmem::ShMemProvider,
}, },
corpus::CorpusScheduler, corpus::CorpusScheduler,
@ -39,6 +28,18 @@ use crate::{
Error, Error,
}; };
#[cfg(all(feature = "std", windows))]
use crate::utils::startable_self;
#[cfg(all(feature = "std", unix))]
use crate::{
bolts::shmem::UnixShMemProvider,
utils::{fork, ForkResult},
};
#[cfg(all(feature = "std", target_os = "android"))]
use crate::bolts::os::ashmem_server::AshmemService;
/// Forward this to the client /// Forward this to the client
const _LLMP_TAG_EVENT_TO_CLIENT: llmp::Tag = 0x2C11E471; const _LLMP_TAG_EVENT_TO_CLIENT: llmp::Tag = 0x2C11E471;
/// Only handle this in the broker /// Only handle this in the broker

View File

@ -11,10 +11,11 @@ use std::{
path::Path, path::Path,
}; };
#[cfg(feature = "std")]
use crate::Error;
use crate::{ use crate::{
bolts::ownedref::OwnedSlice, bolts::ownedref::OwnedSlice,
inputs::{HasBytesVec, HasLen, HasTargetBytes, Input}, inputs::{HasBytesVec, HasLen, HasTargetBytes, Input},
Error,
}; };
/// A bytes input is the basic input /// A bytes input is the basic input