Don't do generalization on larger inptus (#2603)

This commit is contained in:
Dongjia "toka" Zhang 2024-10-10 16:13:08 +02:00 committed by GitHub
parent a69cd98432
commit 19ccb0807c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -111,6 +111,11 @@ where
let input = entry.input_mut().as_mut().unwrap(); let input = entry.input_mut().as_mut().unwrap();
let payload: Vec<_> = input.bytes().iter().map(|&x| Some(x)).collect(); let payload: Vec<_> = input.bytes().iter().map(|&x| Some(x)).collect();
if payload.len() > MAX_GENERALIZED_LEN {
return Ok(());
}
let original = input.clone(); let original = input.clone();
let meta = entry.metadata_map().get::<MapNoveltiesMetadata>().ok_or_else(|| { let meta = entry.metadata_map().get::<MapNoveltiesMetadata>().ok_or_else(|| {
Error::key_not_found(format!( Error::key_not_found(format!(
@ -311,7 +316,6 @@ where
b'"', b'"',
)?; )?;
if payload.len() <= MAX_GENERALIZED_LEN {
// Save the modified input in the corpus // Save the modified input in the corpus
{ {
let meta = GeneralizedInputMetadata::generalized_from_options(&payload); let meta = GeneralizedInputMetadata::generalized_from_options(&payload);
@ -322,7 +326,6 @@ where
let mut entry = state.corpus().get(corpus_id)?.borrow_mut(); let mut entry = state.corpus().get(corpus_id)?.borrow_mut();
entry.metadata_map_mut().insert(meta); entry.metadata_map_mut().insert(meta);
} }
}
Ok(()) Ok(())
} }