From ff8de3e9fa0e0a4ce092a0190f3c00162c22ccaf Mon Sep 17 00:00:00 2001 From: benjaminion Date: Thu, 22 Jun 2017 09:44:34 +0100 Subject: LLL: Fix for edge case in the create macros. When (msize) is initially zero the previous create commands failed due to the "lll" expression overwriting the memory at 0x00. This fix "reserves" memory location 0x00 before calling msize. If msize is already 32 or greater it has no effect. --- liblll/CompilerState.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/liblll/CompilerState.cpp b/liblll/CompilerState.cpp index c76ef655..72078535 100644 --- a/liblll/CompilerState.cpp +++ b/liblll/CompilerState.cpp @@ -54,8 +54,9 @@ void CompilerState::populateStandard() "(def 'msg (gaslimit to value data) { [0]:data (msg gaslimit to value 0 32) })" "(def 'msg (to value data) { [0]:data (msg allgas to value 0 32) })" "(def 'msg (to data) { [0]:data (msg allgas to 0 0 32) })" - "(def 'create (value code) { [0]:(msize) (create value @0 (lll code @0)) })" - "(def 'create (code) { [0]:(msize) (create 0 @0 (lll code @0)) })" + // NOTE: in the create macros, memory location 0 is set in order to force msize to be at least 32 bytes. + "(def 'create (value code) { [0]:0 [0]:(msize) (create value @0 (lll code @0)) })" + "(def 'create (code) { [0]:0 [0]:(msize) (create 0 @0 (lll code @0)) })" "(def 'sha3 (loc len) (keccak256 loc len))" "(def 'sha3 (val) { [0]:val (sha3 0 32) })" "(def 'sha3pair (a b) { [0]:a [32]:b (sha3 0 64) })" -- cgit v1.2.3