forked from TrueCloudLab/neoneo-go
vm: check ByteArray size before converting to Integer
This commit is contained in:
parent
8f5f6fba07
commit
ee9adcdc5c
1 changed files with 2 additions and 3 deletions
|
@ -524,11 +524,10 @@ func (i *ByteArrayItem) TryBytes() ([]byte, error) {
|
||||||
|
|
||||||
// TryInteger implements StackItem interface.
|
// TryInteger implements StackItem interface.
|
||||||
func (i *ByteArrayItem) TryInteger() (*big.Int, error) {
|
func (i *ByteArrayItem) TryInteger() (*big.Int, error) {
|
||||||
bi := emit.BytesToInt(i.value)
|
if len(i.value) > MaxBigIntegerSizeBits/8 {
|
||||||
if bi.BitLen() > MaxBigIntegerSizeBits {
|
|
||||||
return nil, errors.New("integer is too big")
|
return nil, errors.New("integer is too big")
|
||||||
}
|
}
|
||||||
return bi, nil
|
return emit.BytesToInt(i.value), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Equals implements StackItem interface.
|
// Equals implements StackItem interface.
|
||||||
|
|
Loading…
Reference in a new issue