aboutsummaryrefslogtreecommitdiff
path: root/custom_mutators/rust/example
diff options
context:
space:
mode:
authorDominik Maier <domenukk@gmail.com>2021-02-27 15:52:36 +0100
committerDominik Maier <domenukk@gmail.com>2021-02-27 15:52:36 +0100
commitc219502f0fe654927c3f74f9791f786f0740f344 (patch)
treef6960facbd01bf0573199a9320aeb94a32653f1b /custom_mutators/rust/example
parenta5da9ce42cab1eab93cf80ca744944ae26e6ab58 (diff)
downloadafl++-c219502f0fe654927c3f74f9791f786f0740f344.tar.gz
some rust cleanup
Diffstat (limited to 'custom_mutators/rust/example')
-rw-r--r--custom_mutators/rust/example/Cargo.toml6
-rw-r--r--custom_mutators/rust/example/src/example_mutator.rs (renamed from custom_mutators/rust/example/src/lib.rs)7
2 files changed, 7 insertions, 6 deletions
diff --git a/custom_mutators/rust/example/Cargo.toml b/custom_mutators/rust/example/Cargo.toml
index 0c89b200..070d23b1 100644
--- a/custom_mutators/rust/example/Cargo.toml
+++ b/custom_mutators/rust/example/Cargo.toml
@@ -1,5 +1,5 @@
[package]
-name = "example"
+name = "example_mutator"
version = "0.1.0"
authors = ["Julius Hohnerlein <julihoh@users.noreply.github.com>"]
edition = "2018"
@@ -9,5 +9,7 @@ edition = "2018"
[dependencies]
custom_mutator = { path = "../custom_mutator" }
-[lib]
+[[example]]
+name = "example_mutator"
+path = "./src/example_mutator.rs"
crate-type = ["cdylib"] \ No newline at end of file
diff --git a/custom_mutators/rust/example/src/lib.rs b/custom_mutators/rust/example/src/example_mutator.rs
index 4f9345c0..9b9d4997 100644
--- a/custom_mutators/rust/example/src/lib.rs
+++ b/custom_mutators/rust/example/src/example_mutator.rs
@@ -1,14 +1,13 @@
#![allow(unused_variables)]
use custom_mutator::{export_mutator, CustomMutator};
-use std::os::raw::c_uint;
struct ExampleMutator;
impl CustomMutator for ExampleMutator {
type Error = ();
- fn init(seed: c_uint) -> Result<Self, ()> {
+ fn init(seed: u32) -> Result<Self, Self::Error> {
Ok(Self)
}
@@ -17,7 +16,7 @@ impl CustomMutator for ExampleMutator {
buffer: &'b mut [u8],
add_buff: Option<&[u8]>,
max_size: usize,
- ) -> Result<Option<&'b [u8]>, ()> {
+ ) -> Result<Option<&'b [u8]>, Self::Error> {
buffer.reverse();
Ok(Some(buffer))
}
@@ -30,7 +29,7 @@ struct OwnBufferExampleMutator {
impl CustomMutator for OwnBufferExampleMutator {
type Error = ();
- fn init(seed: c_uint) -> Result<Self, ()> {
+ fn init(seed: u32) -> Result<Self, Self::Error> {
Ok(Self {
own_buffer: Vec::new(),
})