cli: add upper bound check for contract ID for 'storage' VM CLI cmd
This commit is contained in:
parent
95cbddf19e
commit
16f5ae3812
1 changed files with 4 additions and 0 deletions
|
@ -10,6 +10,7 @@ import (
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
|
"math"
|
||||||
"math/big"
|
"math/big"
|
||||||
"os"
|
"os"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
@ -1029,6 +1030,9 @@ func getDumpArgs(c *cli.Context) (int32, []byte, error) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return 0, nil, fmt.Errorf("failed to parse contract hash, address or ID: %w", err)
|
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)
|
id = int32(i)
|
||||||
} else {
|
} else {
|
||||||
cs, err := ic.GetContract(h)
|
cs, err := ic.GetContract(h)
|
||||||
|
|
Loading…
Reference in a new issue