add bounds checks for stackless iterator (#2110)
This commit is contained in:
@@ -280,11 +280,13 @@ impl<'a, UMP: UnmarkPolicy> StacklessPreOrderHeapIter<'a, UMP> {
|
|||||||
return Some(cell);
|
return Some(cell);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if self.next < self.heap.len() as u64 {
|
||||||
if self.heap[self.next as usize].get_mark_bit() == self.iter_state.mark_phase() {
|
if self.heap[self.next as usize].get_mark_bit() == self.iter_state.mark_phase() {
|
||||||
let tag = HeapCellValueTag::AttrVar;
|
let tag = HeapCellValueTag::AttrVar;
|
||||||
return Some(HeapCellValue::build_with(tag, next));
|
return Some(HeapCellValue::build_with(tag, next));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
HeapCellValueTag::Var => {
|
HeapCellValueTag::Var => {
|
||||||
let next = self.next;
|
let next = self.next;
|
||||||
let current = self.current;
|
let current = self.current;
|
||||||
@@ -297,11 +299,13 @@ impl<'a, UMP: UnmarkPolicy> StacklessPreOrderHeapIter<'a, UMP> {
|
|||||||
return Some(cell);
|
return Some(cell);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if self.next < self.heap.len() as u64 {
|
||||||
if self.heap[self.next as usize].get_mark_bit() == self.iter_state.mark_phase() {
|
if self.heap[self.next as usize].get_mark_bit() == self.iter_state.mark_phase() {
|
||||||
let tag = HeapCellValueTag::Var;
|
let tag = HeapCellValueTag::Var;
|
||||||
return Some(HeapCellValue::build_with(tag, next));
|
return Some(HeapCellValue::build_with(tag, next));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
HeapCellValueTag::Str => {
|
HeapCellValueTag::Str => {
|
||||||
if self.heap[self.next as usize + 1].get_forwarding_bit() {
|
if self.heap[self.next as usize + 1].get_forwarding_bit() {
|
||||||
self.iter_state.cycle_detected();
|
self.iter_state.cycle_detected();
|
||||||
|
|||||||
Reference in New Issue
Block a user