Skip to content

Commit

Permalink
dev: chg: use math.MaxUint8 for incorrect coversion for integer
Browse files Browse the repository at this point in the history
  • Loading branch information
marcello33 committed Oct 10, 2023
1 parent b7a471c commit c1edeee
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion core/vm/contract.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package vm

import (
"math"
"math/big"

"github.com/ethereum/go-ethereum/common"
Expand Down Expand Up @@ -146,7 +147,7 @@ func (c *Contract) AsDelegate() *Contract {

// GetOp returns the n'th element in the contract's byte array
func (c *Contract) GetOp(n uint64) OpCode {
if len(c.Code) > 0 && len(c.Code) <= 64*1024*1024 && n < uint64(len(c.Code)) {
if len(c.Code) > 0 && len(c.Code) <= math.MaxUint8 && n < uint64(len(c.Code)) {
return OpCode(c.Code[n])

Check failure

Code scanning / CodeQL

Incorrect conversion between integer types High

Incorrect conversion of a 64-bit integer from
strconv.ParseUint
to a lower bit size type uint8 without an upper bound check.
}

Expand Down

0 comments on commit c1edeee

Please sign in to comment.