Reduce range of cleanMemRef

This commit is contained in:
coffeepots 2018-08-16 20:19:53 +01:00 committed by zah
parent fd7062fecb
commit c9de0fbd29
1 changed files with 3 additions and 2 deletions

View File

@ -235,9 +235,10 @@ proc writePaddedResult(mem: var Memory,
func cleanMemRef(x: UInt256): int {.inline.} =
## Sanitize memory addresses, catch negative or impossibly big offsets
# See https://github.com/status-im/nimbus/pull/97 for more info
const upperBound = high(int32).u256
# For rational on shr, see https://github.com/status-im/nimbus/pull/101
const upperBound = (high(int32) shr 2).u256
if x > upperBound:
return high(int32)
return high(int32) shr 2
return x.toInt
op address, inline = true: