Bug 49848 - povray segfaults on incorrect #macro definition
povray segfaults on incorrect #macro definition
Status: CLOSED WONTFIX
Product: Red Hat Powertools
Classification: Retired
Component: povray (Show other bugs)
7.1
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: bero
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2001-07-24 11:38 EDT by David Nečas
Modified: 2008-05-01 11:38 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2002-01-17 10:27:50 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description David Nečas 2001-07-24 11:38:13 EDT
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux 2.2.19 i686; en-US; rv:0.9.1)
Gecko/20010607

Description of problem:
povray segfaults on a #macro definition lacking the () paramter
parenthesis.  However, not on every such a #macro, it depends on statements
preceeding the bad #macro.

How reproducible:
Always

Steps to Reproduce:
1. Create a file crash-me.pov with following content:

  #include "colors.inc"

  #declare Description = "16bit heightfiled, rough, no smoothing"
  #declare FileName = "small"

  #declare LSDistance = 30;

  #macro LightSource0
    light_source{<2*LSDistance,LSDistance,0> White}
  #end

2. run

   $ x-povray +Icrash-me.pov +Ocrash-me.png

	

Actual Results:  It prints following output and segfaults:

Persistence of Vision(tm) Ray Tracer Version 3.1g.Linux.gcc
  This is an unofficial version compiled by:
  Red Hat Software <http://www.redhat.com>
  The POV-Ray Team(tm) is not responsible for supporting this version.
Copyright 1999 POV-Ray Team(tm)
Parsing Options
  Input file: crash-me.pov (compatible to version 3.1)
  Remove bounds........On  Split unions........Off
  Library paths: /usr/lib/povray31 /usr/lib/povray31/include
Output Options
  Image resolution 320 by 240 (rows 1 to 240, columns 1 to 320).
  Output file: crash-me.png, 24 bpp PNG
  Graphic display.....Off
  Mosaic preview......Off
  CPU usage histogram.Off
  Continued trace.....Off  Allow interruption...On  Pause when done.....Off
  Verbose messages....Off
Tracing Options
  Quality:  9
  Bounding boxes.......On  Bounding threshold: 25
  Light Buffer.........On  Vista Buffer.........On
  Antialiasing........Off
  Radiosity...........Off
Animation Options
  Clock value....   0.000  (Animation off)
Redirecting Options
  All Streams to console..........On
  Debug Stream to console.........On
  Fatal Stream to console.........On
  Render Stream to console........On
  Statistics Stream to console....On
  Warning Stream to console.......On


Parsing....#declare LSDistance = 30;

#macro LightSource0

  light_source <----ERROR

crash-me.pov:9: error: ( expected but light_source found instead.
Segmentation fault (core dumped)



Expected Results:  Everything as in Actual results (including the error
message at the end, which is correct), except the segfault.

Additional info:

Whether it crashes or not depends on what preceeds the bad #macro
definition.  So the example I send is one of the shortest files triggering
the bug I was able to create, a #macro alone doesn't suffice.
Comment 1 Tim Powers 2001-07-24 13:24:02 EDT
I getting in tough with the maintainers of povray on this. You may want to do
the same.

Tim
Comment 2 Need Real Name 2001-07-25 12:03:58 EDT
The bug is near line 3153 tokenize.c (function Parse_Macro) you find



  New->Macro_Filename = NULL;

  New->Macro_Name=POV_STRDUP(Token.Token_String);

  

  GET (LEFT_PAREN_TOKEN);

  

  New->Num_Of_Pars=0;  /* <<== BUG! */



change the order to

  

  New->Num_Of_Pars=0; /* Move here! */

  New->Macro_Filename = NULL;

  New->Macro_Name=POV_STRDUP(Token.Token_String);

  

  GET (LEFT_PAREN_TOKEN);



This should fix the crash later on in Destroy_Macro.



-- Thorsten Froehlich, POV-Team

Comment 3 Bernhard Rosenkraenzer 2002-02-07 12:17:05 EST
Thanks for the patch - unfortunately powertools has been discontinued, so there's no next 
release to fix this in.

Note You need to log in before you can comment on or make changes to this bug.