fix handle_in_client borrow, remove testcase.clone()
This commit is contained in:
parent
f4fa7e7b8b
commit
5a382cc351
@ -8,7 +8,6 @@ edition = "2018"
|
|||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
criterion = "0.3" # Benchmarking
|
criterion = "0.3" # Benchmarking
|
||||||
xxhash-rust = { version = "0.8.0-beta.5", features = ["const_xxh3", "xxh3"] } # xxh3 hashing for rust
|
|
||||||
ahash = "0.6.1" # another hash
|
ahash = "0.6.1" # another hash
|
||||||
fxhash = "0.2.1" # yet another hash
|
fxhash = "0.2.1" # yet another hash
|
||||||
|
|
||||||
@ -30,7 +29,7 @@ std = []
|
|||||||
hashbrown = { version = "0.9", features = ["serde"] } # A faster hashmap, nostd compatible
|
hashbrown = { version = "0.9", features = ["serde"] } # A faster hashmap, nostd compatible
|
||||||
libc = "0.2" # For (*nix) libc
|
libc = "0.2" # For (*nix) libc
|
||||||
num = "*"
|
num = "*"
|
||||||
xxhash-rust = { version = "0.8.0-beta.5", features = ["xxh3"] } # xxh3 hashing for rust
|
xxhash-rust = { version = "0.8.0-beta.5", features = ["const_xxh3", "xxh3"] } # xxh3 hashing for rust
|
||||||
serde = { version = "1.0", default-features = false, features = ["alloc"] } # serialization lib
|
serde = { version = "1.0", default-features = false, features = ["alloc"] } # serialization lib
|
||||||
erased-serde = "0.3.12"
|
erased-serde = "0.3.12"
|
||||||
postcard = "0.5.1" # no_std compatible serde serialization fromat
|
postcard = "0.5.1" # no_std compatible serde serialization fromat
|
||||||
|
@ -4,7 +4,6 @@ use core::cell::RefCell;
|
|||||||
use core::convert::Into;
|
use core::convert::Into;
|
||||||
use core::default::Default;
|
use core::default::Default;
|
||||||
use core::option::Option;
|
use core::option::Option;
|
||||||
use hashbrown::HashMap;
|
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
use crate::inputs::Input;
|
use crate::inputs::Input;
|
||||||
|
@ -214,7 +214,7 @@ where
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn handle_in_client(
|
fn handle_in_client(
|
||||||
&self,
|
self,
|
||||||
/*client: &dyn EventManager<S, C, E, I, R>,*/ _state: &mut S,
|
/*client: &dyn EventManager<S, C, E, I, R>,*/ _state: &mut S,
|
||||||
corpus: &mut C,
|
corpus: &mut C,
|
||||||
) -> Result<(), AflError> {
|
) -> Result<(), AflError> {
|
||||||
@ -224,7 +224,7 @@ where
|
|||||||
testcase,
|
testcase,
|
||||||
phantom: _,
|
phantom: _,
|
||||||
} => {
|
} => {
|
||||||
corpus.add(testcase.clone());
|
corpus.add(testcase);
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
_ => Err(AflError::Unknown(
|
_ => Err(AflError::Unknown(
|
||||||
@ -315,19 +315,16 @@ where
|
|||||||
for x in self.events.iter() {
|
for x in self.events.iter() {
|
||||||
handled.push(x.handle_in_broker(state, corpus)?);
|
handled.push(x.handle_in_broker(state, corpus)?);
|
||||||
}
|
}
|
||||||
handled
|
|
||||||
.iter()
|
|
||||||
.zip(self.events.iter())
|
|
||||||
.map(|(x, event)| match x {
|
|
||||||
BrokerEventResult::Forward => event.handle_in_client(state, corpus),
|
|
||||||
// Ignore broker-only events
|
|
||||||
BrokerEventResult::Handled => Ok(()),
|
|
||||||
})
|
|
||||||
.for_each(drop);
|
|
||||||
let count = self.events.len();
|
let count = self.events.len();
|
||||||
|
while self.events.len() > 0 {
|
||||||
|
let event = self.events.pop().unwrap();
|
||||||
|
match handled.pop().unwrap() {
|
||||||
|
BrokerEventResult::Forward => event.handle_in_client(state, corpus)?,
|
||||||
|
// Ignore broker-only events
|
||||||
|
BrokerEventResult::Handled => (),
|
||||||
|
}
|
||||||
|
}
|
||||||
dbg!("Handled {} events", count);
|
dbg!("Handled {} events", count);
|
||||||
self.events.clear();
|
|
||||||
|
|
||||||
Ok(count)
|
Ok(count)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
use alloc::boxed::Box;
|
|
||||||
use alloc::rc::Rc;
|
use alloc::rc::Rc;
|
||||||
use alloc::vec::Vec;
|
use alloc::vec::Vec;
|
||||||
use core::cell::RefCell;
|
use core::cell::RefCell;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user