neo-go/pkg/rpc/server/util.go
Anna Shaleva ae36523a61 rpc, internal: fix CodeQL int conversions warnings
```
Incorrect conversion of an integer with architecture-dependent bit
size from to a lower bit size type int32 without an upper bound
check.
```
2021-04-19 11:30:28 +03:00

20 lines
316 B
Go

package server
import (
"errors"
"math"
)
func checkUint32(i int) error {
if i < 0 || i > math.MaxUint32 {
return errors.New("value should fit uint32")
}
return nil
}
func checkInt32(i int) error {
if i < math.MinInt32 || i > math.MaxInt32 {
return errors.New("value should fit int32")
}
return nil
}