Skip to content

Commit 2ea56cc

Browse files
jwasingerholiman
authored andcommitted
cmd/evm: ensure input length is even (ethereum#24721)
* cmd/evm: ensure input length is even * cmd/evm: minor nit + lintfix Co-authored-by: Martin Holst Swende <martin@swende.se>
1 parent c301e33 commit 2ea56cc

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

cmd/evm/runner.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,12 @@ func runCmd(ctx *cli.Context) error {
246246
} else {
247247
hexInput = []byte(ctx.GlobalString(InputFlag.Name))
248248
}
249-
input := common.FromHex(string(bytes.TrimSpace(hexInput)))
249+
hexInput = bytes.TrimSpace(hexInput)
250+
if len(hexInput)%2 != 0 {
251+
fmt.Println("input length must be even")
252+
os.Exit(1)
253+
}
254+
input := common.FromHex(string(hexInput))
250255

251256
var execFunc func() ([]byte, uint64, error)
252257
if ctx.GlobalBool(CreateFlag.Name) {

0 commit comments

Comments
 (0)