safeguard literal from allowing bad values into physmem
This commit is contained in:
parent
7a9fff6f8b
commit
8259c035e0
1 changed files with 3 additions and 0 deletions
|
@ -299,6 +299,9 @@ class PDP11InstructionAssembler:
|
||||||
|
|
||||||
def literal(self, inst, oprnd=None, /):
|
def literal(self, inst, oprnd=None, /):
|
||||||
"""For hand-assembled instructions. Also allows 1 operand."""
|
"""For hand-assembled instructions. Also allows 1 operand."""
|
||||||
|
# prevent bad values from leaking into physical memory this way
|
||||||
|
if inst < 0 or inst > 65535:
|
||||||
|
raise ValueError(f"Bad instruction literal: {inst}")
|
||||||
return self._1op(inst, oprnd)
|
return self._1op(inst, oprnd)
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue