Skip to content

Commit

Permalink
Fix stb image on windows (#1657)
Browse files Browse the repository at this point in the history
* fix

* fix

* HOW DO I ADD FROM:FROM????

* ok
  • Loading branch information
tokatoka authored Nov 8, 2023
1 parent c97d0fa commit d53503b
Show file tree
Hide file tree
Showing 16 changed files with 19 additions and 4 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,8 @@ jobs:
- uses: ilammy/msvc-dev-cmd@v1
- name: install cxx bridge
run: cargo install cxxbridge-cmd
- name: Build fuzzers/libfuzzer_stb_image
run: cd fuzzers/libfuzzer_stb_image && cargo build --release
- name: Build fuzzers/frida_libpng
run: cd fuzzers/frida_libpng/ && cargo make test
- name: Build fuzzers/frida_gdiplus
Expand Down
2 changes: 1 addition & 1 deletion fuzzers/libfuzzer_stb_image/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ debug = true
[dependencies]
libafl = { path = "../../libafl/" }
libafl_bolts = { path = "../../libafl_bolts/" }
libafl_targets = { path = "../../libafl_targets/", features = ["sancov_pcguard_edges", "sancov_cmplog", "libfuzzer"] }
libafl_targets = { path = "../../libafl_targets/", features = ["sancov_pcguard_edges", "sancov_cmplog", "libfuzzer", "libfuzzer_no_link_main"] }
mimalloc = { version = "*", default-features = false }

[build-dependencies]
Expand Down
1 change: 1 addition & 0 deletions libafl/src/corpus/cached.rs
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,7 @@ where

/// ``CachedOnDiskCorpus`` Python bindings
#[cfg(feature = "python")]
#[allow(clippy::unnecessary_fallible_conversions)]
pub mod pybind {
use alloc::string::String;
use std::path::PathBuf;
Expand Down
1 change: 1 addition & 0 deletions libafl/src/corpus/inmemory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,7 @@ where

/// `InMemoryCorpus` Python bindings
#[cfg(feature = "python")]
#[allow(clippy::unnecessary_fallible_conversions)]
pub mod pybind {
use pyo3::prelude::*;
use serde::{Deserialize, Serialize};
Expand Down
1 change: 1 addition & 0 deletions libafl/src/corpus/inmemory_ondisk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -439,6 +439,7 @@ where
}

#[cfg(feature = "python")]
#[allow(clippy::unnecessary_fallible_conversions)]
/// `InMemoryOnDiskCorpus` Python bindings
pub mod pybind {
use alloc::string::String;
Expand Down
1 change: 1 addition & 0 deletions libafl/src/corpus/ondisk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,7 @@ where
}

#[cfg(feature = "python")]
#[allow(clippy::unnecessary_fallible_conversions)]
/// `OnDiskCorpus` Python bindings
pub mod pybind {
use alloc::string::String;
Expand Down
1 change: 1 addition & 0 deletions libafl/src/events/simple.rs
Original file line number Diff line number Diff line change
Expand Up @@ -579,6 +579,7 @@ where
/// `SimpleEventManager` Python bindings
#[cfg(feature = "python")]
#[allow(missing_docs)]
#[allow(clippy::unnecessary_fallible_conversions)]
pub mod pybind {
use pyo3::prelude::*;

Expand Down
1 change: 1 addition & 0 deletions libafl/src/executors/inprocess.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2214,6 +2214,7 @@ mod tests {

#[cfg(feature = "python")]
#[allow(missing_docs)]
#[allow(clippy::unnecessary_fallible_conversions)]
/// `InProcess` Python bindings
pub mod pybind {
use alloc::boxed::Box;
Expand Down
1 change: 1 addition & 0 deletions libafl/src/feedbacks/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1095,6 +1095,7 @@ impl From<bool> for ConstFeedback {

/// `Feedback` Python bindings
#[cfg(feature = "python")]
#[allow(clippy::unnecessary_fallible_conversions)]
#[allow(missing_docs)]
pub mod pybind {
use std::cell::UnsafeCell;
Expand Down
1 change: 1 addition & 0 deletions libafl/src/generators/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ where
/// `Generator` Python bindings
#[allow(missing_docs)]
#[cfg(feature = "python")]
#[allow(clippy::unnecessary_fallible_conversions)]
pub mod pybind {
use alloc::vec::Vec;

Expand Down
5 changes: 3 additions & 2 deletions libafl/src/monitors/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -847,10 +847,10 @@ impl ClientPerfMonitor {
/// Update the given [`PerfFeature`] with the given `time`
pub fn update_feature(&mut self, feature: PerfFeature, time: u64) {
// Get the current stage index as `usize`
let stage_index: usize = self.curr_stage.try_into().unwrap();
let stage_index: usize = self.curr_stage.into();

// Get the index of the given feature
let feature_index: usize = feature.try_into().unwrap();
let feature_index: usize = feature.into();

if stage_index >= self.stages.len() {
self.stages
Expand Down Expand Up @@ -984,6 +984,7 @@ impl Default for ClientPerfMonitor {
}
/// `Monitor` Python bindings
#[cfg(feature = "python")]
#[allow(clippy::unnecessary_fallible_conversions)]
#[allow(missing_docs)]
pub mod pybind {
use alloc::{boxed::Box, string::String, vec::Vec};
Expand Down
1 change: 1 addition & 0 deletions libafl/src/mutators/scheduled.rs
Original file line number Diff line number Diff line change
Expand Up @@ -603,6 +603,7 @@ mod tests {
/// `SchedulerMutator` Python bindings
#[cfg(feature = "python")]
#[allow(missing_docs)]
#[allow(clippy::unnecessary_fallible_conversions)]
pub mod pybind {
use pyo3::prelude::*;

Expand Down
1 change: 1 addition & 0 deletions libafl/src/observers/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1331,6 +1331,7 @@ where
slice::from_raw_parts_mut(map.as_mut_ptr().add(align_offset) as *mut u16, cnt)
};
// 2022-07: Adding `enumerate` here increases execution speed/register allocation on x86_64.
#[allow(clippy::unused_enumerate_index)]
for (_i, item) in map16[0..cnt].iter_mut().enumerate() {
unsafe {
*item = *COUNT_CLASS_LOOKUP_16.get_unchecked(*item as usize);
Expand Down
1 change: 1 addition & 0 deletions libafl/src/stages/mutational.rs
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,7 @@ where

#[cfg(feature = "python")]
#[allow(missing_docs)]
#[allow(clippy::unnecessary_fallible_conversions)]
/// `StdMutationalStage` Python bindings
pub mod pybind {
use pyo3::prelude::*;
Expand Down
2 changes: 1 addition & 1 deletion libafl_bolts/src/os/unix_shmem_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -556,7 +556,7 @@ where
return Err(Error::illegal_state("Received empty ShMemId from unix shmem client. Are the shmem limits set correctly? Did a client crash?"));
}

let description_id: i32 = description.id.try_into().unwrap();
let description_id: i32 = description.id.into();

if !self.all_shmems.contains_key(&description_id) {
// We should never get here, but it may happen if the OS ran out of shmem pages at some point//reached limits.
Expand Down
1 change: 1 addition & 0 deletions libafl_bolts/src/rands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -435,6 +435,7 @@ mod tests {
}

#[cfg(feature = "python")]
#[allow(clippy::unnecessary_fallible_conversions)]
#[allow(missing_docs)]
/// `Rand` Python bindings
pub mod pybind {
Expand Down

0 comments on commit d53503b

Please sign in to comment.