c4-project / c4f

The C4 Concurrent C Fuzzer
MIT License
14 stars 1 forks source link

`ret` in middle of program is translated incorrectly #8

Closed MattWindsor91 closed 6 years ago

MattWindsor91 commented 6 years ago

The current translation of ret deletes it entirely, which is only valid if it's the last instruction in the program.

For example, the x86 idiom

je L1
ret
L1:

currently ends up

je L1
L1:

which is patently wrong.

Ideally, we should inject an 'end of program' label, convert ret to an unconditional jump to that label, and then perform dead-label analysis to remove the label again if needed.