Revision: 35478
          
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=35478
Author:   blendix
Date:     2011-03-11 23:12:58 +0000 (Fri, 11 Mar 2011)
Log Message:
-----------
Fix #26035: fix crash building raytree with inf/nan values in raytree. There's
many different checks here, but I couldn't handle all cases in fewer lines.

Modified Paths:
--------------
    trunk/blender/source/blender/render/intern/raytrace/rayobject_rtbuild.cpp

Modified: 
trunk/blender/source/blender/render/intern/raytrace/rayobject_rtbuild.cpp
===================================================================
--- trunk/blender/source/blender/render/intern/raytrace/rayobject_rtbuild.cpp   
2011-03-11 22:27:06 UTC (rev 35477)
+++ trunk/blender/source/blender/render/intern/raytrace/rayobject_rtbuild.cpp   
2011-03-11 23:12:58 UTC (rev 35478)
@@ -106,16 +106,19 @@
        INIT_MINMAX(bb, bb+3);
        RE_rayobject_merge_bb(o, bb, bb+3);
 
-       /* skip objects with inf/nan in bounding boxes. we should not be
-          getting these, but in case it happens this avoids crashes */
+       /* skip objects with invalid bounding boxes, nan causes DO_MINMAX
+          to do nothing, so we get these invalid values. this shouldn't
+          happen usually, but bugs earlier in the pipeline can cause it. */
+       if(bb[0] > bb[3] || bb[1] > bb[4] || bb[2] > bb[5])
+               return;
+       /* skip objects with inf bounding boxes */
        if(!finite(bb[0]) || !finite(bb[1]) || !finite(bb[2]))
                return;
        if(!finite(bb[3]) || !finite(bb[4]) || !finite(bb[5]))
                return;
-
        /* skip objects with zero bounding box, they are of no use, and
           will give problems in rtbuild_heuristic_object_split later */
-       if(len_squared_v3v3(bb, bb+3) == 0.0f)
+       if(bb[0] == bb[3] && bb[1] == bb[4] && bb[2] == bb[5])
                return;
        
        copy_v3_v3(b->primitives.end->bb, bb);

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to