native: check that oracle request GAS IsInt64()

We use int64 value down below, so check for IsInt64() while MinimumResponseGas
check still covers for values less than zero.
This commit is contained in:
Roman Khimov 2021-07-19 15:17:45 +03:00
parent 5f13de3a76
commit 79b1bf72aa

View file

@ -329,10 +329,10 @@ func (o *Oracle) request(ic *interop.Context, args []stackitem.Item) stackitem.I
// RequestInternal processes oracle request.
func (o *Oracle) RequestInternal(ic *interop.Context, url string, filter *string, cb string, userData stackitem.Item, gas *big.Int) error {
if len(url) > maxURLLength || (filter != nil && len(*filter) > maxFilterLength) || len(cb) > maxCallbackLength {
if len(url) > maxURLLength || (filter != nil && len(*filter) > maxFilterLength) || len(cb) > maxCallbackLength || !gas.IsInt64() {
return ErrBigArgument
}
if gas.Uint64() < MinimumResponseGas {
if gas.Int64() < MinimumResponseGas {
return ErrLowResponseGas
}
if strings.HasPrefix(cb, "_") {