Bug 49848 - povray segfaults on incorrect #macro definition
Summary: povray segfaults on incorrect #macro definition
Alias: None
Product: Red Hat Powertools
Classification: Retired
Component: povray   
(Show other bugs)
Version: 7.1
Hardware: i386
OS: Linux
Target Milestone: ---
Assignee: bero
QA Contact:
Depends On:
TreeView+ depends on / blocked
Reported: 2001-07-24 15:38 UTC by David Nečas
Modified: 2008-05-01 15:38 UTC (History)
0 users

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

Attachments (Terms of Use)

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

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:

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}

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
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 17:24:02 UTC
I getting in tough with the maintainers of povray on this. You may want to do
the same.


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

  New->Macro_Filename = NULL;





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

change the order to


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

  New->Macro_Filename = NULL;




This should fix the crash later on in Destroy_Macro.

-- Thorsten Froehlich, POV-Team

Comment 3 Bernhard Rosenkraenzer 2002-02-07 17:17:05 UTC
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.