POV-Ray : Newsgroups : povray.unofficial.patches : SuperPatch function{pigment{imag_map{ Server Time
2 Sep 2024 18:14:25 EDT (-0400)
  SuperPatch function{pigment{imag_map{ (Message 1 to 2 of 2)  
From: edna dornblazer
Subject: SuperPatch function{pigment{imag_map{
Date: 10 Jul 1999 13:03:42
Message: <37877C9D.13F2@geocities.com>
When trying out

     function{
         pigment {
             image_map{
                 tga "bad.tga" 
             }	  

with SuperPatch, I found that if the image_map file doesn't exist
or can't be read (etc), and POV tries to do its Error exit routine, 
it was crashing instead. 
The reason seems to be that in Pattern_Structure, 
the image is a member of a C union ('Vals') which I think 
is being initialized to a value for 'gradient',
so when POV tries to free up the Pattern_Structure in 
order to quit, it sees the image pointer as not NULL
and tries to free the image and causes SIGSEGV. 

a fix is very simple in parstxtr.c:

static void Parse_Pattern (TPATTERN *New, int TPat_Type)
{
[ ... ]

     CASE (IMAGE_MAP_TOKEN)
       if (TPat_Type != PIGMENT_TYPE)
       {
	 Only_In("image_map","pigment");
       }

       if (Old_Type==BITMAP_PATTERN) 
       {
	 Destroy_Image(Old_Image);
       }   

       New->Type = BITMAP_PATTERN;
       New->Frequency = 0.0;

       /*a "fix"*/
       New->Vals.Image=NULL;
       /*---*/

       Parse_Image_Map ((PIGMENT *)New);
       EXIT
     END_CASE
[ ... ]

Density_File is part of the same union and may have a similar
problem. but I haven't even tried to find out.


Post a reply to this message

From: edna dornblazer
Subject: Re: SuperPatch function{pigment{imag_map{
Date: 11 Jul 1999 10:04:42
Message: <3788A425.13F1@geocities.com>
edna dornblazer wrote:

> the image is a member of a C union ('Vals') which I think
> is being initialized to a value for 'gradient',

no it isn't. it just isn't initialized, i think.

> Density_File is part of the same union and may have a similar
> problem. but I haven't even tried to find out.

the Density_File member appears ok


Post a reply to this message

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