cli: add upper bound check for contract ID for 'storage' VM CLI cmd

This commit is contained in:
Anna Shaleva 2022-10-07 15:31:07 +03:00
parent 95cbddf19e
commit 16f5ae3812

View file

@ -10,6 +10,7 @@ import (
"errors"
"fmt"
"io"
"math"
"math/big"
"os"
"strconv"
@ -1029,6 +1030,9 @@ func getDumpArgs(c *cli.Context) (int32, []byte, error) {
if err != nil {
return 0, nil, fmt.Errorf("failed to parse contract hash, address or ID: %w", err)
}
if i > math.MaxInt32 {
return 0, nil, fmt.Errorf("contract ID exceeds max int32 value")
}
id = int32(i)
} else {
cs, err := ic.GetContract(h)