]> Repositorios git - scryer-prolog.git/commitdiff
fix crash in read_term (#1616)
authorMark Thom <[email protected]>
Tue, 4 Oct 2022 16:21:50 +0000 (10:21 -0600)
committerMark Thom <[email protected]>
Thu, 27 Oct 2022 05:36:07 +0000 (23:36 -0600)
src/machine/machine_state.rs

index 05ff14c80cc48c4ba262d69370e8fc6b730689a1..1d4be14a034e664e4c00ec741b5a4732e2aa021c 100644 (file)
@@ -536,7 +536,7 @@ impl MachineState {
 
         loop {
             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],
                         (HeapCellValueTag::PStr | HeapCellValueTag::PStrOffset) => {
                             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(
                         &mut self.heap,
                         term_write_result.var_dict.iter().filter(|(_, binding)| {