vm: fix non-dupped items in PICKITEM
TestPICKITEMDupMap and TestPICKITEMDupArray were failing.
This commit is contained in:
parent
a6d60e387a
commit
21efcb012b
2 changed files with 26 additions and 2 deletions
|
@ -958,14 +958,14 @@ func (v *VM) execute(ctx *Context, op opcode.Opcode, parameter []byte) (err erro
|
|||
if index < 0 || index >= len(arr) {
|
||||
panic("PICKITEM: invalid index")
|
||||
}
|
||||
item := arr[index]
|
||||
item := arr[index].Dup()
|
||||
v.estack.PushVal(item)
|
||||
case *MapItem:
|
||||
if !t.Has(key.value) {
|
||||
panic("invalid key")
|
||||
}
|
||||
k := toMapKey(key.value)
|
||||
v.estack.Push(&Element{value: t.value[k]})
|
||||
v.estack.Push(&Element{value: t.value[k].Dup()})
|
||||
default:
|
||||
arr := obj.Bytes()
|
||||
if index < 0 || index >= len(arr) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue