Replace uses std HashMap with hashbrown for consistency (#2387)
* Replace uses std HashMap with hashbrown for consistency * fix * more fix * Hashbrownify libfuzzer_runtime * more
This commit is contained in:
parent
7feeb00546
commit
79cbc16800
@ -1,6 +1,7 @@
|
|||||||
use alloc::vec::Vec;
|
use alloc::vec::Vec;
|
||||||
use std::{collections::HashSet, mem};
|
use core::mem;
|
||||||
|
|
||||||
|
use hashbrown::HashSet;
|
||||||
use libafl_bolts::{rands::Rand, Error};
|
use libafl_bolts::{rands::Rand, Error};
|
||||||
|
|
||||||
use crate::common::nautilus::grammartec::{
|
use crate::common::nautilus::grammartec::{
|
||||||
@ -310,8 +311,9 @@ mod tests {
|
|||||||
string::{String, ToString},
|
string::{String, ToString},
|
||||||
vec::Vec,
|
vec::Vec,
|
||||||
};
|
};
|
||||||
use std::{collections::HashSet, str};
|
use core::str;
|
||||||
|
|
||||||
|
use hashbrown::HashSet;
|
||||||
use libafl_bolts::rands::StdRand;
|
use libafl_bolts::rands::StdRand;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
use alloc::vec::Vec;
|
use alloc::vec::Vec;
|
||||||
use std::{cmp, collections::HashSet, io, io::Write, marker::Sized};
|
use std::{cmp, io, io::Write, marker::Sized};
|
||||||
|
|
||||||
|
use hashbrown::HashSet;
|
||||||
use libafl_bolts::rands::Rand;
|
use libafl_bolts::rands::Rand;
|
||||||
use pyo3::{
|
use pyo3::{
|
||||||
prelude::{PyObject, PyResult, Python},
|
prelude::{PyObject, PyResult, Python},
|
||||||
|
@ -6,8 +6,6 @@
|
|||||||
|
|
||||||
#[cfg(target_arch = "aarch64")]
|
#[cfg(target_arch = "aarch64")]
|
||||||
use core::ffi::c_void;
|
use core::ffi::c_void;
|
||||||
#[cfg(all(feature = "cmplog", target_arch = "x86_64"))]
|
|
||||||
use std::collections::HashMap;
|
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
|
|
||||||
use dynasmrt::dynasm;
|
use dynasmrt::dynasm;
|
||||||
@ -23,6 +21,8 @@ use frida_gum::{
|
|||||||
};
|
};
|
||||||
use frida_gum_sys::Insn;
|
use frida_gum_sys::Insn;
|
||||||
#[cfg(all(feature = "cmplog", target_arch = "x86_64"))]
|
#[cfg(all(feature = "cmplog", target_arch = "x86_64"))]
|
||||||
|
use hashbrown::HashMap;
|
||||||
|
#[cfg(all(feature = "cmplog", target_arch = "x86_64"))]
|
||||||
use iced_x86::{
|
use iced_x86::{
|
||||||
BlockEncoder, Code, DecoderOptions, Instruction, InstructionBlock, MemoryOperand, MemorySize,
|
BlockEncoder, Code, DecoderOptions, Instruction, InstructionBlock, MemoryOperand, MemorySize,
|
||||||
OpKind, Register,
|
OpKind, Register,
|
||||||
|
@ -42,6 +42,7 @@ mimalloc = { version = "0.1.34", default-features = false }
|
|||||||
num-traits = "0.2.15"
|
num-traits = "0.2.15"
|
||||||
rand = "0.8.5"
|
rand = "0.8.5"
|
||||||
serde = { version = "1.0", features = ["derive"] } # serialization lib
|
serde = { version = "1.0", features = ["derive"] } # serialization lib
|
||||||
|
hashbrown = "0.14"
|
||||||
|
|
||||||
# for identifying if we can grimoire-ify
|
# for identifying if we can grimoire-ify
|
||||||
utf8-chars = "3.0.1"
|
utf8-chars = "3.0.1"
|
||||||
|
2
libafl_libfuzzer/libafl_libfuzzer_runtime/rustfmt.toml
Normal file
2
libafl_libfuzzer/libafl_libfuzzer_runtime/rustfmt.toml
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
group_imports = "StdExternalCrate"
|
||||||
|
imports_granularity = "Crate"
|
@ -1,11 +1,12 @@
|
|||||||
use std::{
|
use std::{
|
||||||
cell::RefCell,
|
cell::RefCell,
|
||||||
collections::{hash_map::Entry, BTreeMap, HashMap},
|
collections::BTreeMap,
|
||||||
io::ErrorKind,
|
io::ErrorKind,
|
||||||
path::PathBuf,
|
path::PathBuf,
|
||||||
sync::atomic::{AtomicU64, Ordering},
|
sync::atomic::{AtomicU64, Ordering},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
use hashbrown::{hash_map::Entry, HashMap};
|
||||||
use libafl::{
|
use libafl::{
|
||||||
corpus::{
|
corpus::{
|
||||||
inmemory::{TestcaseStorage, TestcaseStorageMap},
|
inmemory::{TestcaseStorage, TestcaseStorageMap},
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
use std::{
|
use std::{collections::VecDeque, path::PathBuf};
|
||||||
collections::{HashSet, VecDeque},
|
|
||||||
path::PathBuf,
|
|
||||||
};
|
|
||||||
|
|
||||||
|
use hashbrown::HashSet;
|
||||||
use libafl::{Error, HasMetadata};
|
use libafl::{Error, HasMetadata};
|
||||||
use libafl_bolts::impl_serdeany;
|
use libafl_bolts::impl_serdeany;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
use std::{
|
use std::{collections::BTreeSet, marker::PhantomData};
|
||||||
collections::{BTreeSet, HashMap},
|
|
||||||
marker::PhantomData,
|
|
||||||
};
|
|
||||||
|
|
||||||
|
use hashbrown::HashMap;
|
||||||
use libafl::{
|
use libafl::{
|
||||||
corpus::{Corpus, CorpusId, Testcase},
|
corpus::{Corpus, CorpusId, Testcase},
|
||||||
feedbacks::MapNoveltiesMetadata,
|
feedbacks::MapNoveltiesMetadata,
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
#[cfg(emulation_mode = "systemmode")]
|
|
||||||
use std::collections::HashSet;
|
|
||||||
use std::{
|
use std::{
|
||||||
fmt::{Debug, Display, Error, Formatter},
|
fmt::{Debug, Display, Error, Formatter},
|
||||||
rc::Rc,
|
rc::Rc,
|
||||||
@ -7,6 +5,8 @@ use std::{
|
|||||||
|
|
||||||
use enum_map::{Enum, EnumMap};
|
use enum_map::{Enum, EnumMap};
|
||||||
use hashbrown::HashMap;
|
use hashbrown::HashMap;
|
||||||
|
#[cfg(emulation_mode = "systemmode")]
|
||||||
|
use hashbrown::HashSet;
|
||||||
use libafl::{
|
use libafl::{
|
||||||
executors::ExitKind,
|
executors::ExitKind,
|
||||||
inputs::HasTargetBytes,
|
inputs::HasTargetBytes,
|
||||||
|
@ -1,13 +1,8 @@
|
|||||||
#![allow(clippy::cast_possible_wrap)]
|
#![allow(clippy::cast_possible_wrap)]
|
||||||
|
|
||||||
use std::{
|
use std::{borrow::Cow, env, fs, path::PathBuf, sync::Mutex};
|
||||||
borrow::Cow,
|
|
||||||
collections::{HashMap, HashSet},
|
|
||||||
env, fs,
|
|
||||||
path::PathBuf,
|
|
||||||
sync::Mutex,
|
|
||||||
};
|
|
||||||
|
|
||||||
|
use hashbrown::{HashMap, HashSet};
|
||||||
use libafl::{executors::ExitKind, inputs::UsesInput, observers::ObserversTuple, HasMetadata};
|
use libafl::{executors::ExitKind, inputs::UsesInput, observers::ObserversTuple, HasMetadata};
|
||||||
use libc::{
|
use libc::{
|
||||||
c_void, MAP_ANON, MAP_FAILED, MAP_FIXED, MAP_NORESERVE, MAP_PRIVATE, PROT_READ, PROT_WRITE,
|
c_void, MAP_ANON, MAP_FAILED, MAP_FIXED, MAP_NORESERVE, MAP_PRIVATE, PROT_READ, PROT_WRITE,
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
use core::{fmt::Debug, ops::Range};
|
use core::{fmt::Debug, ops::Range};
|
||||||
use std::{cell::UnsafeCell, collections::HashSet, hash::BuildHasher};
|
use std::{cell::UnsafeCell, hash::BuildHasher};
|
||||||
|
|
||||||
|
use hashbrown::HashSet;
|
||||||
use libafl::{executors::ExitKind, inputs::UsesInput, observers::ObserversTuple};
|
use libafl::{executors::ExitKind, inputs::UsesInput, observers::ObserversTuple};
|
||||||
use libafl_bolts::tuples::{MatchFirstType, SplitBorrowExtractFirstType};
|
use libafl_bolts::tuples::{MatchFirstType, SplitBorrowExtractFirstType};
|
||||||
use libafl_qemu_sys::{GuestAddr, GuestPhysAddr};
|
use libafl_qemu_sys::{GuestAddr, GuestPhysAddr};
|
||||||
|
@ -1,10 +1,6 @@
|
|||||||
use std::{
|
use std::{cell::UnsafeCell, mem::MaybeUninit, sync::Mutex};
|
||||||
cell::UnsafeCell,
|
|
||||||
collections::{HashMap, HashSet},
|
|
||||||
mem::MaybeUninit,
|
|
||||||
sync::Mutex,
|
|
||||||
};
|
|
||||||
|
|
||||||
|
use hashbrown::{HashMap, HashSet};
|
||||||
use libafl::{inputs::UsesInput, HasMetadata};
|
use libafl::{inputs::UsesInput, HasMetadata};
|
||||||
use libafl_qemu_sys::{GuestAddr, MmapPerms};
|
use libafl_qemu_sys::{GuestAddr, MmapPerms};
|
||||||
use meminterval::{Interval, IntervalTree};
|
use meminterval::{Interval, IntervalTree};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user