POV-Ray : Newsgroups : povray.general : Bug in source/lighting.cpp InitMallocPools() Server Time
26 Dec 2024 13:54:53 EST (-0500)
  Bug in source/lighting.cpp InitMallocPools() (Message 1 to 2 of 2)  
From: Paul Bowen-Huggett
Subject: Bug in source/lighting.cpp InitMallocPools()
Date: 8 Feb 2006 15:58:23
Message: <PM00040C4EC06AA8F8@82-46-5-87.stb.ubr03.azte.blueyonder.co.uk>
Hi,

I've been working on an experimental port of Povray 3.6.1 to a new platform:
one on which a long is 64-bits, and a pointer 32. I've been tracking down an
error due to the end of a block of memory being over-written and have narrowed
it down to the file source/lighting.cpp. This contains the following code in
InitMallocPools():

  ShadowMediaListPoolSize = (long *)POV_MALLOC(MaxMediaPoolDepth*sizeof(long
*), "temp media list");
  LightingMediaListPoolSize = (long *)POV_MALLOC(MaxMediaPoolDepth*sizeof(long
*), "temp media list");
  MediaIntervalPoolSize = (long *)POV_MALLOC(MaxMediaPoolDepth*sizeof(long *),
"temp media list");

The fix would obviously be to replace the "*sizeof (long *)" with
"sizeof(long)":

  ShadowMediaListPoolSize = (long *)POV_MALLOC(MaxMediaPoolDepth*sizeof(long),
"temp media list");
  LightingMediaListPoolSize = (long
*)POV_MALLOC(MaxMediaPoolDepth*sizeof(long), "temp media list");
  MediaIntervalPoolSize = (long *)POV_MALLOC(MaxMediaPoolDepth*sizeof(long),
"temp media list");

Apologies if I'm not reporting this to the right place, or it was fixed long
ago...!

HTH,
Paul


Post a reply to this message

From: Christoph Hormann
Subject: Re: Bug in source/lighting.cpp InitMallocPools()
Date: 9 Feb 2006 06:30:03
Message: <dsf8vm$m8c$1@chho.imagico.de>
Paul Bowen-Huggett wrote:
> [...]
> 
> Apologies if I'm not reporting this to the right place, or it was fixed long
> ago...!

It's the correct place and this seems indeed a bug - seems like systems 
with sizeof(long) > sizeof(pointer) are extremely rare.

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.