[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [58514] trunk/blender/source/blender/ modifiers/intern/MOD_ocean.c: fix/ workaround for crash in ocean modifier when size is zero ( causes invalid array index/lookups).

Campbell Barton ideasman42 at gmail.com
Mon Jul 22 23:02:45 CEST 2013


Revision: 58514
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=58514
Author:   campbellbarton
Date:     2013-07-22 21:02:45 +0000 (Mon, 22 Jul 2013)
Log Message:
-----------
fix/workaround for crash in ocean modifier when size is zero (causes invalid array index/lookups).

Modified Paths:
--------------
    trunk/blender/source/blender/modifiers/intern/MOD_ocean.c

Modified: trunk/blender/source/blender/modifiers/intern/MOD_ocean.c
===================================================================
--- trunk/blender/source/blender/modifiers/intern/MOD_ocean.c	2013-07-22 20:53:52 UTC (rev 58513)
+++ trunk/blender/source/blender/modifiers/intern/MOD_ocean.c	2013-07-22 21:02:45 UTC (rev 58514)
@@ -426,6 +426,11 @@
 
 	const float size_co_inv = 1.0f / (omd->size * omd->spatial_size);
 
+	/* can happen in when size is small, avoid bad array lookups later and quit now */
+	if (!isfinite(size_co_inv)) {
+		return derivedData;
+	}
+
 	/* update modifier */
 	if (omd->refresh & MOD_OCEAN_REFRESH_ADD)
 		omd->ocean = BKE_add_ocean();
@@ -531,7 +536,7 @@
 		}
 	}
 
-	#undef OCEAN_CO
+#undef OCEAN_CO
 
 	return dm;
 }




More information about the Bf-blender-cvs mailing list