aboutsummaryrefslogtreecommitdiffstats
path: root/core/vm
diff options
context:
space:
mode:
authorLiang Ma <liangma@liangbit.com>2019-03-29 05:04:31 +0800
committerLiang Ma <liangma@liangbit.com>2019-03-29 05:04:31 +0800
commit157f09e5b64bd4ba8a579c4719cf504d68f4b925 (patch)
tree97be0f9a60f3650e768ef1ff5171443b820bd8d1 /core/vm
parent5b0d3fa39359c027882705c221b6ddb5cd73f3d9 (diff)
downloadgo-tangerine-157f09e5b64bd4ba8a579c4719cf504d68f4b925.tar
go-tangerine-157f09e5b64bd4ba8a579c4719cf504d68f4b925.tar.gz
go-tangerine-157f09e5b64bd4ba8a579c4719cf504d68f4b925.tar.bz2
go-tangerine-157f09e5b64bd4ba8a579c4719cf504d68f4b925.tar.lz
go-tangerine-157f09e5b64bd4ba8a579c4719cf504d68f4b925.tar.xz
go-tangerine-157f09e5b64bd4ba8a579c4719cf504d68f4b925.tar.zst
go-tangerine-157f09e5b64bd4ba8a579c4719cf504d68f4b925.zip
core/vm: Correct the Memory Gas Overflow condition
previous overflow condition is too big to use. 0x7FFFFFFFF squre operation is overflowed uint64. 0x7FFFFFFFF^2 = 0x3F FFFF FFF0 0000 0001
Diffstat (limited to 'core/vm')
-rw-r--r--core/vm/gas_table.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/core/vm/gas_table.go b/core/vm/gas_table.go
index 6400c1324..8b034a0e7 100644
--- a/core/vm/gas_table.go
+++ b/core/vm/gas_table.go
@@ -32,11 +32,11 @@ func memoryGasCost(mem *Memory, newMemSize uint64) (uint64, error) {
// The maximum that will fit in a uint64 is max_word_count - 1
// anything above that will result in an overflow.
// Additionally, a newMemSize which results in a
- // newMemSizeWords larger than 0x7ffffffff will cause the square operation
+ // newMemSizeWords larger than 0xFFFFFFFF will cause the square operation
// to overflow.
- // The constant 0xffffffffe0 is the highest number that can be used without
+ // The constant 0x1FFFFFFFE0 is the highest number that can be used without
// overflowing the gas calculation
- if newMemSize > 0xffffffffe0 {
+ if newMemSize > 0x1FFFFFFFE0 {
return 0, errGasUintOverflow
}