[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [33086] trunk/blender/source/blender/ blenlib/intern/math_rotation.c: Bugfix, reported in IRC

Ton Roosendaal ton at blender.org
Mon Nov 15 14:33:38 CET 2010


Revision: 33086
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=33086
Author:   ton
Date:     2010-11-15 14:33:38 +0100 (Mon, 15 Nov 2010)

Log Message:
-----------
Bugfix, reported in IRC

The enum "rotmode" was read using an array, without checking for boundary
cases, causing crashes on bad input. (Wahooney report 2, thanks!)

Modified Paths:
--------------
    trunk/blender/source/blender/blenlib/intern/math_rotation.c

Modified: trunk/blender/source/blender/blenlib/intern/math_rotation.c
===================================================================
--- trunk/blender/source/blender/blenlib/intern/math_rotation.c	2010-11-15 13:11:40 UTC (rev 33085)
+++ trunk/blender/source/blender/blenlib/intern/math_rotation.c	2010-11-15 13:33:38 UTC (rev 33086)
@@ -1084,7 +1084,7 @@
  * NOTE: since we start at 1 for the values, but arrays index from 0, 
  *		 there is -1 factor involved in this process...
  */
-#define GET_ROTATIONORDER_INFO(order) (((order)>=1) ? &rotOrders[(order)-1] : &rotOrders[0])
+#define GET_ROTATIONORDER_INFO(order) ( ((order)>5 || (order < 1)) ? &rotOrders[0] : &rotOrders[(order)-1] )
 
 /* Construct quaternion from Euler angles (in radians). */
 void eulO_to_quat(float q[4], const float e[3], const short order)





More information about the Bf-blender-cvs mailing list