POV-Ray : Newsgroups : povray.programming : Segfault due to short int overflow at bbox.cpp:596 : Re: Segfault due to short int overflow at bbox.cpp:596 Server Time
18 May 2024 08:42:04 EDT (-0400)
  Re: Segfault due to short int overflow at bbox.cpp:596  
From: Christoph Hormann
Date: 29 Dec 2005 11:40:04
Message: <dp1384$ltk$1@chho.imagico.de>
Eric Buddington wrote:
> POV-Ray 3.6.1
> bbox.cpp:596
> 
> If there are too many (>32k) infinite objects, the short int index 'i'
> overflows
> and attempts to reference Infinite[-32767], which naturally spews core.
> 
> I suggest throwing an error in the case of overflow, and perhaps bumping up
> 'i' to an unsigned int, if there's any sane scene that uses 32k infinite
> objects.

Seems correct although to be consistent with other places 
(Build_Bounding_Slabs) you should use 'long'.

> Less critically, I'd suggest moving the declaration of 'i' to the top of the
> block enclosing the 'for' loop, or into the 'for' loop itself. It would
> make the code a little easier to read, though I don't know what your coding
> standards are.

This code is quite old so the declarations obey older restrictions.

Christoph

-- 
POV-Ray tutorials, include files, Landscape of the week:
http://www.imagico.de/ (Last updated 31 Oct. 2005)
MegaPOV with mechanics simulation: http://megapov.inetart.net/


Post a reply to this message

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