Fix buffer overflow using bbone segment interpolation

Do proper segment clamping to a proper value.

Thanks Brecht for pair-coding!
This commit is contained in:
Sergey Sharybin
2019-09-19 16:54:09 +02:00
parent 1bf0384111
commit 931d280af7

View File

@@ -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;