[Bf-blender-cvs] [22c0555cc55] blender-v2.83-release: Fix out of bounds array access in mathutils.noise

Campbell Barton noreply at git.blender.org
Wed Dec 2 08:50:17 CET 2020


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

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 8ec0c9ce44a..53656c4dcb2 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