mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 18:32:23 +00:00
fix integer underflow (#374)
Signed-off-by: Ignacio Hagopian <jsign.uy@gmail.com>
This commit is contained in:
parent
077ad8728f
commit
8ac057090e
1 changed files with 5 additions and 3 deletions
|
|
@ -401,11 +401,13 @@ func touchCodeChunksRangeOnReadAndChargeGas(contractAddr []byte, startPC, size u
|
|||
return 0
|
||||
}
|
||||
|
||||
// endPC is the last PC that must be touched.
|
||||
endPC := startPC + size - 1
|
||||
if startPC+size > codeLen {
|
||||
endPC := startPC + size
|
||||
if endPC > codeLen {
|
||||
endPC = codeLen
|
||||
}
|
||||
if endPC > 0 {
|
||||
endPC -= 1 // endPC is the last bytecode that will be touched.
|
||||
}
|
||||
|
||||
var statelessGasCharged uint64
|
||||
for chunkNumber := startPC / 31; chunkNumber <= endPC/31; chunkNumber++ {
|
||||
|
|
|
|||
Loading…
Reference in a new issue