NULL pointer dereference in carp_vm_make()
Closed this issue · 2 comments
https://github.com/tekknolagi/carp/blob/master/src/carp_machine.c#L52 dereferences res
although https://github.com/tekknolagi/carp/blob/master/src/carp_machine.c#L49 checked for res == NULL
and https://github.com/tekknolagi/carp/blob/master/src/carp_machine.c#L50 certainly doesn't quit Carp.
Why does it not quit Carp?
Let's say res == NULL
is true
: carp_vm_err
calls carp_vm_exit
which sets m->regs[CARP_RUN]
to 0. Then it unwinds back into carp_vm_make
and you continue execution with setting m->regs[CARP_RUN]
to 1. All in the meantime exit()
not having been called at all. I understand that you want to exit carp on an error condition by setting the program code to exit carp, but I am almost certain separating VM code paths from program code paths is a good idea, at least it's simpler :)