forked from TrueCloudLab/neoneo-go
vm: forbid jumping out of the script bounds
This commit is contained in:
parent
a5b5f88fe2
commit
1005c1f7db
1 changed files with 1 additions and 1 deletions
|
@ -91,7 +91,7 @@ func (c *Context) NextIP() int {
|
|||
|
||||
// Jump unconditionally moves the next instruction pointer to the specified location.
|
||||
func (c *Context) Jump(pos int) {
|
||||
if pos < 0 || pos > len(c.prog) {
|
||||
if pos < 0 || pos >= len(c.prog) {
|
||||
panic("instruction offset is out of range")
|
||||
}
|
||||
c.nextip = pos
|
||||
|
|
Loading…
Reference in a new issue