POV-Ray : Newsgroups : povray.bugreports : Some known bugs making povray to crash Server Time
22 Nov 2024 18:55:39 EST (-0500)
  Some known bugs making povray to crash (Message 1 to 3 of 3)  
From: Nieminen Mika
Subject: Some known bugs making povray to crash
Date: 16 Dec 1998 11:52:37
Message: <3677e555.0@news.povray.org>
A good program should never crash, no matter what's the input. If the
input is illegal, a good program issues an error message saying clearly
what's the problem.

  Now, povray fails on this in some cases:

  - The documentation says that you can make at most 10 nested #includes
    (ie. include files which include files which include files and so on).
    This is acceptable. What is not acceptable is that when you exceed the
    limit, povray crashes (or at least the dos version does). It should
    output an error message like "maximum number of nested include files
    reached" instead and exit normally.

  - There seems to be also a maximum number of recursive macro calls you can
    make. Also ok, but again povray crashes when it's reached. It should
    issue an error message like "maximum macro recursion limit reached"
    instead.

  - At least in the dos and the windows versions there seems to be a stack
    overflow problem when a too big max_trace_level is specified which makes
    povray to crash. Since those versions are compiled with watcom, I think
    it shouldn't be a bad idea to enable the stack overflow checking when
    compiling. This way, when the stack overflows, the program issues the
    error "Stack overflow" instead of crashing.
    Also a bigger stack is a must. Say, something like 128k instead of the
    default 8k which watcom makes.

-- 
main(i){char*_="BdsyFBThhHFBThhHFRz]NFTITQF|DJIFHQhhF";while(i=
*_++)for(;i>1;printf("%s",i-70?i&1?"[]":" ":(i=0,"\n")),i/=2);} /*- Warp. -*/


Post a reply to this message

From: Ron Parker
Subject: Re: Some known bugs making povray to crash
Date: 16 Dec 1998 14:16:37
Message: <36780715.0@news.povray.org>
On 16 Dec 1998 11:52:37 -0500, Nieminen Mika <war### [at] assaricctutfi> wrote:
>  - The documentation says that you can make at most 10 nested #includes
>    (ie. include files which include files which include files and so on).
>    This is acceptable. What is not acceptable is that when you exceed the
>    limit, povray crashes (or at least the dos version does). It should
>    output an error message like "maximum number of nested include files
>    reached" instead and exit normally.

A fix for this has been posted to this group previously.  The problem isn't
that POV doesn't detect the problem, it's that the detection code has a tiny
bug.  Also, if the documentation says 10 then I believe it's incorrect.  
IIRC, the size of the stack is much bigger in 3.1 than in 3.0.

>  - There seems to be also a maximum number of recursive macro calls you can
>    make. Also ok, but again povray crashes when it's reached. It should
>    issue an error message like "maximum macro recursion limit reached"
>    instead.

I believe macros and includes share the same stack, so these two bugs are
actually the same bug.

>    Also a bigger stack is a must. Say, something like 128k instead of the
>    default 8k which watcom makes.

It's worth mentioning that Win32 programs, at least, have dynamic stacks.
POV-Ray for Windows v3.1 reserves 128 pages (512K) for the stack, and commits 
16 pages (64K) at startup.  This means that for a stack fault to occur, the
stack must grow beyond 512K, though it may also be possible to page-fault if 
the stack has grown beyond the initial commit and the stack pointer is 
artificially decremented by 4K or more and then used without accessing the 
intervening page. This could be caused by some common function prologs if 
the functions use too many local (stack) variables.

For what it's worth, I rendered the attached scene on a PII/333 with 128M of
RAM running Windows 98 and the official POVWin 3.1a without a crash (though 
I stopped it after 5 minutes of rendering a single pixel.)  A version with 
max_trace_level 50 and no reflection rendered to completion with no problems, 
as did a version with concentric nonreflecting spheres, and even concentric 
spheres of differing IOR.  All went to the maximum trace level at least once.  
This problem isn't as cut-and-dried as it may appear.

-------- begin scene -------
/* max_trace_level torture test */
light_source {<0, -20, 20> color rgb 1}
camera {location <0,0,-20> look_at <0,0,0>}
global_settings {max_trace_level 100}

#declare i=0;
#while ( i < 100 )
  #declare i=i+1;
  sphere { .1*i*z, .02 
      texture {pigment {color rgbf .99} finish {reflection .9}}}
#end
-------- end scene ---------


Post a reply to this message

From: Nieminen Mika
Subject: Re: Some known bugs making povray to crash
Date: 17 Dec 1998 09:18:20
Message: <367912ac.0@news.povray.org>
Ron Parker <par### [at] my-dejanewscom> wrote:
:  Also, if the documentation says 10 then I believe it's incorrect.  
: IIRC, the size of the stack is much bigger in 3.1 than in 3.0.

  From the Pov3.1 documentation:

4.2.1 Include Files and the #include Directive.
...
Include files may be nested. You may have at most 10 nested include files.
There is no limit on un-nested include files.


  What I have tested, if you try to include more than exactly 10 nested
include files in the dos version, the program crashes.

-- 
main(i){char*_="BdsyFBThhHFBThhHFRz]NFTITQF|DJIFHQhhF";while(i=
*_++)for(;i>1;printf("%s",i-70?i&1?"[]":" ":(i=0,"\n")),i/=2);} /*- Warp. -*/


Post a reply to this message

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