POV-Ray : Newsgroups : povray.bugreports : POV 3.1 Infinite Recursion Bug-Fix Server Time
22 Nov 2024 19:36:09 EST (-0500)
  POV 3.1 Infinite Recursion Bug-Fix (Message 1 to 2 of 2)  
From: Nigel Stewart
Subject: POV 3.1 Infinite Recursion Bug-Fix
Date: 17 Oct 1998 03:03:30
Message: <36283332.0@news.povray.org>
(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

From: Nigel Stewart
Subject: Re: POV 3.1 Infinite Recursion Bug-Fix
Date: 28 Nov 1998 01:11:10
Message: <365f93fe.0@news.povray.org>
Just a note to report that this problem also applies to
the latest official windows binary of POV 3.1a

Nigel Stewart wrote in message <36283332.0@news.povray.org>...
>(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

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.