POV-Ray : Newsgroups : povray.beta-test : v3.8 attempted load of radiosity file core dumps. : Re: v3.8 attempted load of radiosity file core dumps. Server Time
26 Apr 2024 06:59:39 EDT (-0400)
  Re: v3.8 attempted load of radiosity file core dumps.  
From: Le Forgeron
Date: 7 Feb 2021 07:34:40
Message: <601fde60@news.povray.org>
Le 06/02/2021 à 21:11, William F Pokorny a écrit :
> On 12/7/20 12:16 PM, William F Pokorny wrote:
>> For future reference.
>>
>> On Ubuntu 18.04 g++9
>>
>> povray bogus.pov Radiosity_File_Name="RadSamples" +rfo +rfi
>>
>> coredumps unless the RadSamples file exists. The file can be empty
>> and things are fine but it must exist.
> ...
>>
> 
> This is a problem in source/core/lighting/radiosity.cpp. In the function
> RadiosityCache::Load change:
> 
>     if (fd != nullptr)
>     {
> 
> to
> 
>     if (*fd)  // Natural is (fd != nullptr), but IStream has overrides
>     {         // of !fd and *fd for testing.
> 
> Bill P.

Beware of leakage when opening fails.

I wonder if the change should not be a two-level check:
1. is the object != nullptr (as previous) ( if (fd != nullptr) )
2. is the read/open not in fail state ( if (*fd) )

The "delete fd;" being outside the second block.

The first block handle memory failure (or not, "new" would throw, and
that is not catched locally).

So actually, I think your change of the test is correct, BUT the "delete
fd;" must be moved outside the block too.


Post a reply to this message

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