Skip to content

Commit

Permalink
add append/discard_metadata for and/or/not feedback (#86)
Browse files Browse the repository at this point in the history
* add append/discard_metadata for and/or/not feedback

* fix
  • Loading branch information
tokatoka authored and andreafioraldi committed May 6, 2021
1 parent 099cb0b commit 921ab9e
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions libafl/src/feedbacks/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,18 @@ where
let b = self.second.is_interesting(input, observers, exit_kind)?;
Ok(a && b)
}

#[inline]
fn append_metadata(&mut self, testcase: &mut Testcase<I>) -> Result<(), Error> {
self.first.append_metadata(testcase)?;
self.second.append_metadata(testcase)
}

#[inline]
fn discard_metadata(&mut self, input: &I) -> Result<(), Error> {
self.first.discard_metadata(input)?;
self.second.discard_metadata(input)
}
}

impl<A, B, I> Named for AndFeedback<A, B, I>
Expand Down Expand Up @@ -143,6 +155,18 @@ where
let b = self.second.is_interesting(input, observers, exit_kind)?;
Ok(a || b)
}

#[inline]
fn append_metadata(&mut self, testcase: &mut Testcase<I>) -> Result<(), Error> {
self.first.append_metadata(testcase)?;
self.second.append_metadata(testcase)
}

#[inline]
fn discard_metadata(&mut self, input: &I) -> Result<(), Error> {
self.first.discard_metadata(input)?;
self.second.discard_metadata(input)
}
}

impl<A, B, I> Named for OrFeedback<A, B, I>
Expand Down Expand Up @@ -201,6 +225,16 @@ where
{
Ok(!self.first.is_interesting(input, observers, exit_kind)?)
}

#[inline]
fn append_metadata(&mut self, testcase: &mut Testcase<I>) -> Result<(), Error> {
self.first.append_metadata(testcase)
}

#[inline]
fn discard_metadata(&mut self, input: &I) -> Result<(), Error> {
self.first.discard_metadata(input)
}
}

impl<A, I> Named for NotFeedback<A, I>
Expand Down

0 comments on commit 921ab9e

Please sign in to comment.