sigsegv on version 2.30 using Linux
Brought to you by:
kerravon86,
tcamp
I'm using a Slackware 12.2 system kernel 2.6.27.7
After compiling and installing bwbasic 2.30 it failed every time I tried to run it with a sigsegv.
I debugged it by running bwbasic under gdb.
The failing line was line 2518 of bwb_var.c in function
var_islocal().
Line 2518 is:
for ( v = CURTASK excs[ CURTASK exsc ].local_variable; v != NULL; v = v->next )
It turns out that variable exsc is -1 and an invalid table index.
To fix the problem I test variable exsc and if it is less than zero then make the function return with a NULL value.
Attached is a patch file that should fix the problem.
patch to fix sigsegv from bwb_var.c
The code shown disappeared in a revamp by another developer. If you're still having a problem, I will need a fresh patch.