(Crossposted to DKB List...)
This email is a fix for the 'Infinite
Recursion Macro' bug, reported on the
DKB mail list 11/10/1998.
>I have found what I consider to be a bug
>in POV-Ray 3.1 Accidently causing a
>macro to infinitely recurse causes POV-ray
>to seg-fault.
>
>Here is some pov code which produces the
>problem:
>
>#version 3.1;
>
>#macro F()
> F()
>#end
>
>F()
I have built a Pov-Ray 3.1 binary for Win32 from
the MSDOS sources distribution. The reason for
the seg-fault appears reasonably obvious:
1. Check that we havn't allocated too many
symbol tables.
Add_Sym_Table(char *s) [tokenise.c]
...
if ((Table_Index++)==MAX_NUMBER_OF_TABLES)
{
Error("Too many nested symbol tables");
}
...
2. Error handler decides the error is fatal,
and tries to free resources:
void Terminate_Tokenizer() [tokenise.c]
...
while(Table_Index >= 0)
{
Destroy_Table(Table_Index--);
}
...
The problem is that the table index is
out of range for the first 'Destroy_Table'
call. The fix is to decrement
Table_Index before handling the error:
Add_Sym_Table(char *s) [tokenise.c]
...
if ((Table_Index++)==MAX_NUMBER_OF_TABLES)
{
Table_Index--;
Error("Too many nested symbol tables");
}
...
Post a reply to this message
|