Revision: 56233
          http://sourceforge.net/p/brlcad/code/56233
Author:   phoenixyjll
Date:     2013-07-26 13:21:22 +0000 (Fri, 26 Jul 2013)
Log Message:
-----------
right might be NULL, causing sub_curve() to crash. Fix this by returning NULL.

Modified Paths:
--------------
    brlcad/trunk/src/libbrep/intersect.cpp

Modified: brlcad/trunk/src/libbrep/intersect.cpp
===================================================================
--- brlcad/trunk/src/libbrep/intersect.cpp      2013-07-26 12:47:22 UTC (rev 
56232)
+++ brlcad/trunk/src/libbrep/intersect.cpp      2013-07-26 13:21:22 UTC (rev 
56233)
@@ -275,7 +275,7 @@
     sub.MakeIncreasing();
     if (!sub.Intersection(dom))
        return NULL;
-    ON_Curve *left = NULL, *right = NULL;
+    ON_Curve *left = NULL, *right = NULL, *three = NULL;
     if (ON_NearZero(sub.m_t[0] - dom.m_t[0]))
        right = in->Duplicate();
     else
@@ -283,13 +283,19 @@
     if (left)
        delete left;
     left = NULL;
+    if (!right) {
+       bu_log("Error: sub_curve(): a = %lf, b = %lf\n", a, b);
+       return NULL;
+    }
     if (ON_NearZero(sub.m_t[1] - dom.m_t[1]))
        left = right->Duplicate();
     else {
-       right->Split(sub.m_t[1], left, right);
+       right->Split(sub.m_t[1], left, three);
     }
     if (right)
        delete right;
+    if (three)
+       delete three;
     return left;
 }
 

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
See everything from the browser to the database with AppDynamics
Get end-to-end visibility with application monitoring from AppDynamics
Isolate bottlenecks and diagnose root cause in seconds.
Start your free trial of AppDynamics Pro today!
http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to