Skip to content

Commit

Permalink
Merge pull request cosmos#274 from CosmWasm/prevent_overflow
Browse files Browse the repository at this point in the history
Prevent integer overflow
  • Loading branch information
ethanfrey authored Oct 7, 2020
2 parents 3571625 + 5fbf4ae commit ad4262a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion x/wasm/internal/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -559,7 +559,10 @@ func (k Keeper) dispatchMessages(ctx sdk.Context, contractAddr sdk.AccAddress, m

func gasForContract(ctx sdk.Context) uint64 {
meter := ctx.GasMeter()
remaining := (meter.Limit() - meter.GasConsumed()) * GasMultiplier
if meter.IsOutOfGas() {
return 0
}
remaining := (meter.Limit() - meter.GasConsumedToLimit()) * GasMultiplier
if remaining > MaxGas {
return MaxGas
}
Expand Down

0 comments on commit ad4262a

Please sign in to comment.