Fix accidental infinite loop in fuzz targets (#5103)
The `libfuzzer-sys` update in #5068 included some changes to the `fuzz_target!` macro which caused a bare `run` function to be shadowed by the macro-defined `run` function (changed in rust-fuzz/libfuzzer#95) which meant that some of our fuzz targets were infinite looping or stack overflowing as the same function was called indefinitely. This renames the top-level `run` function to something else in the meantime.
This commit is contained in:
@@ -53,10 +53,10 @@ fuzz_target!(|data: &[u8]| {
|
|||||||
|
|
||||||
// Errors in `run` have to do with not enough input in `data`, which we
|
// Errors in `run` have to do with not enough input in `data`, which we
|
||||||
// ignore here since it doesn't affect how we'd like to fuzz.
|
// ignore here since it doesn't affect how we'd like to fuzz.
|
||||||
drop(run(&data));
|
drop(execute_one(&data));
|
||||||
});
|
});
|
||||||
|
|
||||||
fn run(data: &[u8]) -> Result<()> {
|
fn execute_one(data: &[u8]) -> Result<()> {
|
||||||
STATS.bump_attempts();
|
STATS.bump_attempts();
|
||||||
|
|
||||||
let mut u = Unstructured::new(data);
|
let mut u = Unstructured::new(data);
|
||||||
|
|||||||
@@ -12,10 +12,10 @@ const MAX_MODULES: usize = 5;
|
|||||||
fuzz_target!(|data: &[u8]| {
|
fuzz_target!(|data: &[u8]| {
|
||||||
// errors in `run` have to do with not enough input in `data`, which we
|
// errors in `run` have to do with not enough input in `data`, which we
|
||||||
// ignore here since it doesn't affect how we'd like to fuzz.
|
// ignore here since it doesn't affect how we'd like to fuzz.
|
||||||
drop(run(data));
|
drop(execute_one(data));
|
||||||
});
|
});
|
||||||
|
|
||||||
fn run(data: &[u8]) -> Result<()> {
|
fn execute_one(data: &[u8]) -> Result<()> {
|
||||||
let mut u = Unstructured::new(data);
|
let mut u = Unstructured::new(data);
|
||||||
let mut config: generators::Config = u.arbitrary()?;
|
let mut config: generators::Config = u.arbitrary()?;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user