fix out of bounds interrupt mutation
This commit is contained in:
parent
a9ce2d787b
commit
fb3837f725
@ -88,8 +88,13 @@ pub fn try_force_new_branches(interrupt_ticks : &[u32], fbs: &STGFeedbackState,
|
|||||||
if !(exec_interval.start_capture.0==CaptureEvent::ISRStart) { // shortcut to skip interrupt handers without node lookup
|
if !(exec_interval.start_capture.0==CaptureEvent::ISRStart) { // shortcut to skip interrupt handers without node lookup
|
||||||
let node_index = fbs.state_abb_hash_index.get(&exec_interval.get_hash_index()).unwrap();
|
let node_index = fbs.state_abb_hash_index.get(&exec_interval.get_hash_index()).unwrap();
|
||||||
if !has_interrupt_handler_non_systick(&fbs.graph, node_index.clone()) {
|
if !has_interrupt_handler_non_systick(&fbs.graph, node_index.clone()) {
|
||||||
new_interrupt_times.push((exec_interval.start_tick.saturating_add((exec_interval.end_tick+exec_interval.start_tick)/4)).try_into().expect("ticks > u32"));
|
let new_time = exec_interval.start_tick.saturating_add((exec_interval.end_tick+exec_interval.start_tick)/4);
|
||||||
new_interrupt_times.append(interrupt_ticks[num+2..].to_vec().as_mut());
|
new_interrupt_times.push(new_time.try_into().expect("ticks > u32"));
|
||||||
|
if (new_time + config.1 as u64) < next as u64 { // the new interrupt is not too close to the next one
|
||||||
|
new_interrupt_times.extend(interrupt_ticks.iter().skip(num).cloned());
|
||||||
|
} else { // the new interrupt is too close to the next one, skip the next one
|
||||||
|
new_interrupt_times.extend(interrupt_ticks.iter().skip(num+1).cloned());
|
||||||
|
}
|
||||||
new=true;
|
new=true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user