Skip to content

Cheap reader for bytes slice #2261

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 35 commits into from
Jul 30, 2024
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
9672556
initial draft implementation
rmalmain May 29, 2024
c22af4a
change name to follow rust convention.
rmalmain May 29, 2024
75b4563
revert use of HasTargetBytes instead of HasMutatorBytes for BytesSubI…
rmalmain May 29, 2024
0557eb1
clippy
rmalmain May 29, 2024
ce49d42
nostd
rmalmain May 29, 2024
20ce359
clippy
rmalmain May 29, 2024
caa6cac
clippy
rmalmain May 29, 2024
0eb55b3
* HasLen required if implementing HasTargetBytes.
rmalmain May 30, 2024
050622c
clippy
rmalmain May 30, 2024
383a259
Merge branch 'main' into bytes_reader
domenukk Jun 3, 2024
38a7941
fix name.
rmalmain Jun 3, 2024
7657577
Merge branch 'main' into bytes_reader
rmalmain Jul 2, 2024
e86ca6a
added a common bytes trait for HasTargetBytes and HasMutatorBytes.
rmalmain Jul 3, 2024
3bfec8f
Merge branch 'main' into bytes_reader
rmalmain Jul 3, 2024
6c28a92
change interface
rmalmain Jul 4, 2024
e3e2d8e
fix tests
rmalmain Jul 4, 2024
31aa955
clippers
rmalmain Jul 4, 2024
4763e5c
Merge branch 'main' into bytes_reader
rmalmain Jul 12, 2024
8c76adb
use byte slice for subbytes
rmalmain Jul 15, 2024
7394b54
Merge branch 'main' into bytes_reader
rmalmain Jul 15, 2024
69e34d5
adapt to main
rmalmain Jul 15, 2024
83172d4
fix doc
rmalmain Jul 15, 2024
d8e0791
mut sub slice version. return subinput to old state, and add subslice…
rmalmain Jul 17, 2024
b6dccc6
Merge branch 'main' into bytes_reader
rmalmain Jul 17, 2024
bf1d209
better api, doc fixes.
rmalmain Jul 17, 2024
4197824
Merge branch 'main' into bytes_reader
rmalmain Jul 18, 2024
d111e9e
Don't clone, reshuffle
domenukk Jul 18, 2024
1371646
Move and rename
domenukk Jul 18, 2024
2bbf4ef
Uh-oh
domenukk Jul 18, 2024
da2d4c6
move to bolts. rename things.
rmalmain Jul 19, 2024
d37c630
nostd
rmalmain Jul 19, 2024
8d3c447
format
rmalmain Jul 19, 2024
9092044
alloc
rmalmain Jul 19, 2024
fb9b17e
fix doc
rmalmain Jul 19, 2024
04e53a2
Merge branch 'main' into bytes_reader
domenukk Jul 30, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 2 additions & 9 deletions libafl/src/inputs/bytes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ use core::{
use std::{fs::File, io::Read, path::Path};

use ahash::RandomState;
use libafl_bolts::HasLen;
#[cfg(feature = "std")]
use libafl_bolts::{fs::write_file_atomic, Error};
use libafl_bolts::{ownedref::OwnedSlice, HasLen};
use serde::{Deserialize, Serialize};

use crate::inputs::{HasMutatorBytes, HasTargetBytes, Input};
use crate::inputs::{HasMutatorBytes, Input};

/// A bytes input is the basic input
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, Eq, Hash)]
Expand Down Expand Up @@ -96,13 +96,6 @@ impl HasMutatorBytes for BytesInput {
}
}

impl HasTargetBytes for BytesInput {
#[inline]
fn target_bytes(&self) -> OwnedSlice<u8> {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't be a blanket impl, keep this one (IMHO)

OwnedSlice::from(&self.bytes)
}
}

impl HasLen for BytesInput {
#[inline]
fn len(&self) -> usize {
Expand Down
Loading
Loading