[Bf-blender-cvs] [c70650785bf] blender-v2.91-release: Fix out of bounds array access in mathutils.noise

Campbell Barton noreply at git.blender.org
Thu Oct 22 05:06:50 CEST 2020


Commit: c70650785bffb5f111c3c81c7c37dff4d5a9a446
Author: Campbell Barton
Date:   Thu Oct 22 14:03:00 2020 +1100
Branches: blender-v2.91-release
https://developer.blender.org/rBc70650785bffb5f111c3c81c7c37dff4d5a9a446

Fix out of bounds array access in mathutils.noise

Regression in 0b2d1badecc48.

===================================================================

M	source/blender/python/mathutils/mathutils_noise.c

===================================================================

diff --git a/source/blender/python/mathutils/mathutils_noise.c b/source/blender/python/mathutils/mathutils_noise.c
index eece782f6d0..49a3f114ebb 100644
--- a/source/blender/python/mathutils/mathutils_noise.c
+++ b/source/blender/python/mathutils/mathutils_noise.c
@@ -140,11 +140,11 @@ static void next_state(void)
   left = N;
   next = state;
 
-  for (j = N - M + 1; j--; p++) {
+  for (j = N - M + 1; --j; p++) {
     *p = p[M] ^ TWIST(p[0], p[1]);
   }
 
-  for (j = M; j--; p++) {
+  for (j = M; --j; p++) {
     *p = p[M - N] ^ TWIST(p[0], p[1]);
   }



More information about the Bf-blender-cvs mailing list