(fuzzer: &mut Fuzzer)
| 25 | |
| 26 | impl I2SRandomReplacement { |
| 27 | pub fn init(fuzzer: &mut Fuzzer) -> Option<Self> { |
| 28 | let input_id = fuzzer.input_id?; |
| 29 | tracing::debug!("[{input_id}] multi-stream extend input-to-state stage"); |
| 30 | |
| 31 | Snapshot::restore_initial(fuzzer); |
| 32 | fuzzer.state.input.seek_to_start(); |
| 33 | |
| 34 | let (_, comparisons) = finder::capture_comparisons(fuzzer)?; |
| 35 | if fuzzer.debug.cmplog && fuzzer.global.is_main_instance() { |
| 36 | if let Some(cmplog) = fuzzer.cmplog { |
| 37 | let _ = log_cmplog_data( |
| 38 | &mut fuzzer.vm, |
| 39 | cmplog, |
| 40 | &fuzzer.workdir.join(format!("cmplog/{input_id}.ext.cmplog.txt")), |
| 41 | ); |
| 42 | } |
| 43 | } |
| 44 | |
| 45 | let mut streams = get_non_empty_streams(&fuzzer.state.input); |
| 46 | streams.retain(|&(addr, _)| !crate::utils::is_interrupt_stream(addr)); |
| 47 | if streams.is_empty() { |
| 48 | return None; |
| 49 | } |
| 50 | let stream_distr = get_stream_weights(fuzzer, input_id, &streams); |
| 51 | |
| 52 | Some(Self { |
| 53 | comparisons, |
| 54 | finder: ReplacementFinder::new(fuzzer.features.strided_int_matches), |
| 55 | streams, |
| 56 | stream_distr, |
| 57 | }) |
| 58 | } |
| 59 | |
| 60 | pub fn random_replace(&mut self, fuzzer: &mut Fuzzer) -> Option<()> { |
| 61 | const MAX_REPLACEMENT_ATTEMPTS: usize = 100; |
nothing calls this directly
no test coverage detected