Module Name:    xsrc
Committed By:   nat
Date:           Thu Jan 29 22:48:18 UTC 2015

Modified Files:
        xsrc/external/mit/glu/dist/src/libtess: sweep.c

Log Message:
Fixes segfaults and crashing in applications that use libGLU.

This commit was approved by wiz@


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r1.2 xsrc/external/mit/glu/dist/src/libtess/sweep.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: xsrc/external/mit/glu/dist/src/libtess/sweep.c
diff -u xsrc/external/mit/glu/dist/src/libtess/sweep.c:1.1.1.1 xsrc/external/mit/glu/dist/src/libtess/sweep.c:1.2
--- xsrc/external/mit/glu/dist/src/libtess/sweep.c:1.1.1.1	Tue Dec 16 06:01:15 2014
+++ xsrc/external/mit/glu/dist/src/libtess/sweep.c	Thu Jan 29 22:48:18 2015
@@ -546,7 +546,9 @@ static int CheckForRightSplice( GLUtesse
     if( EdgeSign( eUp->Dst, eLo->Org, eUp->Org ) < 0 ) return FALSE;
 
     /* eLo->Org appears to be above eUp, so splice eLo->Org into eUp */
-    RegionAbove(regUp)->dirty = regUp->dirty = TRUE;
+    if (RegionAbove(regUp))
+        RegionAbove(regUp)->dirty = TRUE;
+    regUp->dirty = TRUE;
     if (__gl_meshSplitEdge( eUp->Sym ) == NULL) longjmp(tess->env,1);
     if ( !__gl_meshSplice( eLo->Oprev, eUp ) ) longjmp(tess->env,1);
   }
@@ -584,7 +586,9 @@ static int CheckForLeftSplice( GLUtessel
     if( EdgeSign( eUp->Dst, eLo->Dst, eUp->Org ) < 0 ) return FALSE;
 
     /* eLo->Dst is above eUp, so splice eLo->Dst into eUp */
-    RegionAbove(regUp)->dirty = regUp->dirty = TRUE;
+    if (RegionAbove(regUp))
+        RegionAbove(regUp)->dirty = TRUE;
+    regUp->dirty = TRUE;
     e = __gl_meshSplitEdge( eUp );
     if (e == NULL) longjmp(tess->env,1);
     if ( !__gl_meshSplice( eLo->Sym, e ) ) longjmp(tess->env,1);
@@ -718,7 +722,9 @@ static int CheckForIntersect( GLUtessela
      * (and wait for ConnectRightVertex to splice it appropriately).
      */
     if( EdgeSign( dstUp, tess->event, &isect ) >= 0 ) {
-      RegionAbove(regUp)->dirty = regUp->dirty = TRUE;
+      if (RegionAbove(regUp))
+          RegionAbove(regUp)->dirty = TRUE;
+      regUp->dirty = TRUE;
       if (__gl_meshSplitEdge( eUp->Sym ) == NULL) longjmp(tess->env,1);
       eUp->Org->s = tess->event->s;
       eUp->Org->t = tess->event->t;
@@ -753,7 +759,9 @@ static int CheckForIntersect( GLUtessela
      longjmp(tess->env,1);
   }
   GetIntersectData( tess, eUp->Org, orgUp, dstUp, orgLo, dstLo );
-  RegionAbove(regUp)->dirty = regUp->dirty = regLo->dirty = TRUE;
+  if (RegionAbove(regUp))
+      RegionAbove(regUp)->dirty = TRUE;
+  regUp->dirty = regLo->dirty = TRUE;
   return FALSE;
 }
 

Reply via email to