diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2019-09-19 17:54:09 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2019-09-19 17:55:14 +0300 |
commit | 931d280af78877d5d86a6473e4963d4f9edb8aeb (patch) | |
tree | 6ca291645205d563a289b5f0f3cee06c3c4d7b99 /source/blender | |
parent | 1bf03841110c77cd39d40be9e028b6c823f16618 (diff) |
Fix buffer overflow using bbone segment interpolation
Do proper segment clamping to a proper value.
Thanks Brecht for pair-coding!
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/blenkernel/intern/armature.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/source/blender/blenkernel/intern/armature.c b/source/blender/blenkernel/intern/armature.c index d74c8e6d258..3215b3d7b40 100644 --- a/source/blender/blenkernel/intern/armature.c +++ b/source/blender/blenkernel/intern/armature.c @@ -1257,9 +1257,9 @@ void BKE_pchan_bbone_deform_segment_index(const bPoseChannel *pchan, float pre_blend = pos * (float)segments; int index = (int)floorf(pre_blend); - float blend = pre_blend - index; + CLAMP(index, 0, segments - 1); - CLAMP(index, 0, segments); + float blend = pre_blend - index; CLAMP(blend, 0.0f, 1.0f); *r_index = index; |