vm: restrict max size in APPEND
This commit is contained in:
parent
8abcaeee6f
commit
2d56c66bde
2 changed files with 24 additions and 0 deletions
|
@ -786,10 +786,16 @@ func (v *VM) execute(ctx *Context, op Instruction, parameter []byte) {
|
|||
switch t := arrElem.value.(type) {
|
||||
case *ArrayItem:
|
||||
arr := t.Value().([]StackItem)
|
||||
if len(arr) >= MaxArraySize {
|
||||
panic("too long array")
|
||||
}
|
||||
arr = append(arr, val)
|
||||
t.value = arr
|
||||
case *StructItem:
|
||||
arr := t.Value().([]StackItem)
|
||||
if len(arr) >= MaxArraySize {
|
||||
panic("too long struct")
|
||||
}
|
||||
arr = append(arr, val)
|
||||
t.value = arr
|
||||
default:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue