From 4d2afa262430a98571b29a0eae065c8462c65f6a Mon Sep 17 00:00:00 2001 From: Roman Khimov Date: Fri, 7 Oct 2022 17:10:04 +0300 Subject: [PATCH] cli/vm: use ParseInt to properly (and easily) check for int32 --- cli/vm/cli.go | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/cli/vm/cli.go b/cli/vm/cli.go index 69456ea86..ad4f3a184 100644 --- a/cli/vm/cli.go +++ b/cli/vm/cli.go @@ -10,7 +10,6 @@ import ( "errors" "fmt" "io" - "math" "math/big" "os" "strconv" @@ -1026,13 +1025,10 @@ func getDumpArgs(c *cli.Context) (int32, []byte, error) { ) h, err := flags.ParseAddress(hashOrID) if err != nil { - i, err := strconv.Atoi(hashOrID) + i, err := strconv.ParseInt(hashOrID, 10, 32) 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)