MAGIC Magic Mailing List
 
 

From: R. Timothy Edwards (tim AT stravinsky DOT jhuapl.edu)
Date: Mon Jul 10 2000 - 15:15:54 EDT


From: "R. Timothy Edwards" <tim>
To: dan AT rothenbuhler DOT com
Subject: subtle magic error
Cc: magic_dev AT csl DOT cornell.edu

Dear Dan,
   Because I don't normally use the "extresis" function, I haven't run
across this error before.  I am CC'ing this message to the magic_dev
in case anyone else has run across it.  Unless somebody there has any
reason to suspect that my solution is wrong, then this fix should work.

   Here's the problem:  Everything pointing to the problem is in
resis/ResFract.c, as you pointed out.  It starts with ResCheckConcavity(),
which wanders around the tile list and makes calls to resWalkup, resWalkdown,
resWalkleft, and resWalkright.  In your file, the program crashed after
calling resWalkdown().  This is what happened:

   1) resWalkdown() was called with last parameter func = ResSplitX
   2) resWalkdown() calls the function ResSplitX like this:
                if (func) (*func)(tile,xpos);
   3) ResSplitX calls TiJoinY().  TiJoinY() is responsible for combining
        two tiles.  When this happens, the second of the two is no longer
        necessary and is deleted---that is, its memory is freed.  When
        TiJoinY() is called with "tile" (passed from above) as its second
        parameter, "tile" is freed.
   4) ResSplitX returns
   5) resWalkdown() continues to use the value "tile" even though it may
        no longer exist!

   Here's my assumed solution:  ResSplitX should return "tile" at the
        end, and the calling functions (resWalk*) should replace it as
        necessary, such that

                if (func) (*func)(tile,xpos);

        becomes

                if (func) tile = (*func)(tile,xpos);

        in each routine resWalkup, resWalkdown, resWalkleft, and resWalkright.
        This appears to solve the error.

   I will send you a replacement file for ResFract.c; for the magic_dev
people CC'd on this email, the fix will be in the CVS repository for magic
version 7.1.
                                                        ---Tim


 
 
Questions? Contact Rajit Manohar
cornell logo