Code in this form probably won't be generated naturally, but it could be used for obfuscation. By jumping into a function hash in the dispatch (like my recent challenge did), I was able to confuse ethersplay into producing a loop and being unable to identify the dispatched functions:
(I use a function aekS() which hashes to 0x5b61291c, jumpdest; push2 XX)
EVM does not allow jumping to jumpdests that happen to be in immediate values (ie pushed values).
For example something like this contract.
When calling test(), EVM will always throw when it tries to execute the jump. However ethersplay shows it falling though to the embedded code:
Geth makes a bitmap of all valid jumpdests to determine if any jumpdests are in immediate values.
Code in this form probably won't be generated naturally, but it could be used for obfuscation. By jumping into a function hash in the dispatch (like my recent challenge did), I was able to confuse ethersplay into producing a loop and being unable to identify the dispatched functions:
(I use a function
aekS()
which hashes to 0x5b61291c,jumpdest; push2 XX
)