Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The JIT epilogue could be wrong and lead to segmentation fault #2

Open
mobsceneZ opened this issue Aug 12, 2024 · 0 comments
Open

The JIT epilogue could be wrong and lead to segmentation fault #2

mobsceneZ opened this issue Aug 12, 2024 · 0 comments

Comments

@mobsceneZ
Copy link

Hi Becavalier, I think the function epilogue in bfJITCompile miscalculates the jump offset and can lead to segmentation fault if the provided brainfuck input does not contain . opcode:

std::vector<uint8_t> byteCode {
REX_CMPD_R11, 0x0,
JE_SHORT, 0x8,
CALLQ, /* mem slot */
JMPQ_RSP,
};

The je 8 is wrong since it jumps across the the jmpq *(%rsp) instruction. I think the correct instruction should be je 5.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant