Bug in LoadFlt

New Message Reply Date view Thread view Subject view Author view

Ran Yakir (rany++at++bvr.co.il)
Wed, 27 Jul 1994 14:43:53 +0000


Hi,

I found a bug in all the versions of LoadFlt11, namely in libpfflt.a,
libpfflt14.a and libpfsgi (the Flt11 loader).
The bug is connected with vertex-less polygons. Such a polygon is represented
by a polygon bead which is not followed by any push, pop or vertices. Normally,
if the empty polygon is in the middle of the object (i.e. followed by other
polygons), it will be discarded because the AddPoly11 function reaches a case
of a plygon bead (the next polygon) and returns.
However, if this polygon happens to be the last in its object, the AddPoly11
function will encounter a pop bead (the pop of the object), and will advance
the mg file pointer. The next object, which is in the same level, will be
considered a son of the previous. this "missing pop" will continue to distrupt
the hirarchy of the file up to the end of the file.
I know this bug exists in the un-sourced versions of LoadFlt11 because the
memory representation of the object is exactly the same as the one I get with
the old sourced version.
The bug could be fixed in pfflt_geom.c by replacing the lines

case MG_POP:
        depth --;
        if (depth <= 0)
                done = 1;
        break;

by

case MG_POP:
        depth --;
        if (depth == 0)
                done = 1;
        else
        if (depth < 0)
                return ptr; /* do not advance ptr */

        break;

Good luck

Ran Yakir

-- 
 __                                  | Ran Yakir
 /_)  _  __   \  / _   / o __        | Graphics App. Chief Engineer
/ )_ (_(_) )   \/ (_(_/<_(_)(        | BVR Technologies Ltd.
              _/                     |   
-------------------------------------+--------------------------------
Phone :                              | E-mail : rany++at++bvr.co.il
  Work : 972-3-5715671               |
  Res. : 972-3-6995364               |
Fax    : 972-3-5715668               |

New Message Reply Date view Thread view Subject view Author view

This archive was generated by hypermail 2.0b2 on Mon Aug 10 1998 - 17:50:25 PDT

This message has been cleansed for anti-spam protection. Replace '++at++' in any mail addresses with the '@' symbol.