fix crash in read_term (#1616)

This commit is contained in:
Mark Thom
2022-10-04 10:21:50 -06:00
parent 9055370326
commit 140149f051

View File

@@ -536,7 +536,7 @@ impl MachineState {
loop { loop {
match self.read(stream, &indices.op_dir) { match self.read(stream, &indices.op_dir) {
Ok(term_write_result) => { Ok(mut term_write_result) => {
let heap_loc = read_heap_cell!(self.heap[term_write_result.heap_loc], let heap_loc = read_heap_cell!(self.heap[term_write_result.heap_loc],
(HeapCellValueTag::PStr | HeapCellValueTag::PStrOffset) => { (HeapCellValueTag::PStr | HeapCellValueTag::PStrOffset) => {
pstr_loc_as_cell!(term_write_result.heap_loc) pstr_loc_as_cell!(term_write_result.heap_loc)
@@ -568,6 +568,10 @@ impl MachineState {
} }
} }
for var in term_write_result.var_dict.values_mut() {
*var = heap_bound_deref(&self.heap, *var);
}
let singleton_var_list = push_var_eq_functors( let singleton_var_list = push_var_eq_functors(
&mut self.heap, &mut self.heap,
term_write_result.var_dict.iter().filter(|(_, binding)| { term_write_result.var_dict.iter().filter(|(_, binding)| {