add bounds check for attributed variables slice
This commit is contained in:
@@ -82,19 +82,23 @@ impl MachineState {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub(super) fn gather_attr_vars_created_since(&mut self, b: usize) -> IntoIter<HeapCellValue> {
|
pub(super) fn gather_attr_vars_created_since(&mut self, b: usize) -> IntoIter<HeapCellValue> {
|
||||||
let mut attr_vars: Vec<_> = self.attr_var_init.attr_var_queue[b..]
|
let mut attr_vars: Vec<_> = if b >= self.attr_var_init.attr_var_queue.len() {
|
||||||
.iter()
|
vec![]
|
||||||
.filter_map(|h| {
|
} else {
|
||||||
read_heap_cell!(self.store(self.deref(heap_loc_as_cell!(*h))), //Addr::HeapCell(*h))) {
|
self.attr_var_init.attr_var_queue[b..]
|
||||||
(HeapCellValueTag::AttrVar, h) => {
|
.iter()
|
||||||
Some(attr_var_as_cell!(h))
|
.filter_map(|h| {
|
||||||
}
|
read_heap_cell!(self.store(self.deref(heap_loc_as_cell!(*h))),
|
||||||
_ => {
|
(HeapCellValueTag::AttrVar, h) => {
|
||||||
None
|
Some(attr_var_as_cell!(h))
|
||||||
}
|
}
|
||||||
)
|
_ => {
|
||||||
})
|
None
|
||||||
.collect();
|
}
|
||||||
|
)
|
||||||
|
})
|
||||||
|
.collect()
|
||||||
|
};
|
||||||
|
|
||||||
attr_vars.sort_unstable_by(|a1, a2| {
|
attr_vars.sort_unstable_by(|a1, a2| {
|
||||||
compare_term_test!(self, *a1, *a2).unwrap_or(Ordering::Less)
|
compare_term_test!(self, *a1, *a2).unwrap_or(Ordering::Less)
|
||||||
|
|||||||
Reference in New Issue
Block a user