box64
box64 copied to clipboard
[BOX64] error on test siglongjump
Hi ptitSeb, I found an issue in the my_longjmp function in the file src/wrapped/wrappedlibc.cin box64. The correct fix is as follows:
Change:
R_RAX = __val;
to:
if (__val == 0) { R_RAX = 1; } else { R_RAX = __val; }
test case for verification:
#include <stdio.h> #include <setjmp.h>
sigjmp_buf env;
int main() { int r = sigsetjmp(env, 1); if (r == 0) { printf("first\n"); siglongjmp(env, 0); } else { printf("second %d\n", r); } return 0; }
Ah indeed, I'll fix that thanks.