Skip to content

Commit

Permalink
check that Target is an atom in scoped_clause_to_evacuable (#2248)
Browse files Browse the repository at this point in the history
  • Loading branch information
mthom committed Dec 29, 2023
1 parent 781f4af commit 75302ab
Showing 1 changed file with 27 additions and 3 deletions.
30 changes: 27 additions & 3 deletions src/machine/loader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1833,9 +1833,33 @@ impl Machine {
}

pub(crate) fn scoped_clause_to_evacuable(&mut self) -> CallResult {
let module_name = cell_as_atom!(self
.machine_st
.store(self.machine_st.deref(self.machine_st.registers[1])));
let target = self.deref_register(1);

let mut permission_error = || {
let err = self.machine_st.permission_error(
Permission::Modify,
atom!("static_procedure"),
functor_stub(atom!(":"), 2)
.into_iter()
.collect::<MachineStub>(),
);

self.machine_st
.error_form(err, functor_stub(atom!("load"), 1))
};

let module_name = read_heap_cell!(target,
(HeapCellValueTag::Atom, (name, arity)) => {
if arity == 0 {
name
} else {
return Err(permission_error());
}
}
_ => {
return Err(permission_error());
}
);

let loader = self.loader_from_heap_evacuable(temp_v!(3));

Expand Down

0 comments on commit 75302ab

Please sign in to comment.