core/vm: fix error in memory calculation

This commit is contained in:
Martin Holst Swende 2019-03-07 12:01:46 +01:00
parent e17df3ebce
commit 1f5c28d833
No known key found for this signature in database
GPG key ID: 683B438C05A5DDF0

View file

@ -28,7 +28,7 @@ import (
func calcMemSize64(off, l *big.Int) (uint64, bool) {
// if length is zero, memsize is always zero, regardless of offset
if l.Sign() == 0 {
return 0, true
return 0, false
}
// Check that neither offset nor length overflows
if off.BitLen() > 64 || l.BitLen() > 64 {
@ -51,7 +51,7 @@ func calcMemSize64(off, l *big.Int) (uint64, bool) {
func calcMemSize64WithUint(off *big.Int, length64 uint64) (uint64, bool) {
// if length is zero, memsize is always zero, regardless of offset
if length64 == 0 {
return 0, true
return 0, false
}
// Check that offset doesn't overflow
if off.BitLen() > 64 {