Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a2c8709

Browse files
committed
fix: added padding for jumpdest
1 parent e86a65d commit a2c8709

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

builder/evm/runtime.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,8 @@ func (t *Builder) pickRuntimeCode() (*RuntimeCode, error) {
129129
Offset: offset,
130130
Length: code.Len(),
131131
})
132-
offset += code.Len()
132+
// +1: each block in "referenced" is prefixed by OpJumpDestiny (1 byte)
133+
offset += 1 + code.Len()
133134
} else {
134135
rootinsts = append(rootinsts, inst)
135136
}

builder/evm/runtime_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ ident bcde = { true; };`,
141141
},
142142
{
143143
Selector: []byte("bcde"),
144-
Offset: 28,
144+
Offset: 29, // 1 (JUMPDEST) + 28 (first block code length)
145145
Length: 8,
146146
Instructions: insts2,
147147
},

0 commit comments

Comments
 (0)