forked from TrueCloudLab/neoneo-go
vm: allow custom limit duing Map\Array\Struct deserialization
This commit is contained in:
parent
15fa65d30f
commit
25ed5fcd60
1 changed files with 2 additions and 2 deletions
|
@ -304,7 +304,7 @@ func (r *deserContext) decodeBinary() Item {
|
||||||
return NewBigInteger(num)
|
return NewBigInteger(num)
|
||||||
case ArrayT, StructT:
|
case ArrayT, StructT:
|
||||||
size := int(r.ReadVarUint())
|
size := int(r.ReadVarUint())
|
||||||
if size > MaxDeserialized {
|
if size > r.limit {
|
||||||
r.Err = errTooBigElements
|
r.Err = errTooBigElements
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
@ -319,7 +319,7 @@ func (r *deserContext) decodeBinary() Item {
|
||||||
return NewStruct(arr)
|
return NewStruct(arr)
|
||||||
case MapT:
|
case MapT:
|
||||||
size := int(r.ReadVarUint())
|
size := int(r.ReadVarUint())
|
||||||
if size > MaxDeserialized {
|
if size > r.limit/2 {
|
||||||
r.Err = errTooBigElements
|
r.Err = errTooBigElements
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue