You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
With this program eval(jc, "-[>-[>-<-]<-]<-]".into()), the brainfuck interpreter panics, because it sees an unknown symbol at the program counter (garbage memory)
With eval(jc, "-[>-[>-[>-<-]<-]<-]<-]".into()) - the program receives a SIGSEGV, caused by a read of one byte before an allocated page.
I'll try to run these with ASAN and report the results
EDIT: I can't build with ASAN, because kernel32-sys fails to link. Brainfart, I need to pass the --target flag, but holyjit also fails to link.
EDIT2: I just realized the brackets in these programs are mismatched, which means bounds checks aren't emitted properly under jit!()
The text was updated successfully, but these errors were encountered:
mateon1
changed the title
Bad memory access (garbage & SIGSEGV) in brainfuck example
Jitted code doesn't check if slice index is in bounds
Oct 23, 2017
I usually use rr to debug the generate code, as you can walk the code execution backward.
I can reproduce this issue. I got a SEGV which corresponds to the panic with the message "Unknown Symbol". The problem likely comes from the code which is being produced by the array access[1], which is probably always checked, but never appear in the MIR.
With this program
eval(jc, "-[>-[>-<-]<-]<-]".into())
, the brainfuck interpreter panics, because it sees an unknown symbol at the program counter (garbage memory)With
eval(jc, "-[>-[>-[>-<-]<-]<-]<-]".into())
- the program receives a SIGSEGV, caused by a read of one byte before an allocated page.I'll try to run these with ASAN and report the results
EDIT: I can't build with ASAN,
because. Brainfart, I need to pass thekernel32-sys
fails to link--target
flag, butholyjit
also fails to link.EDIT2: I just realized the brackets in these programs are mismatched, which means bounds checks aren't emitted properly under jit!()
The text was updated successfully, but these errors were encountered: