etch-a-ton: off by one error
authorCampbell Barton <ideasman42@gmail.com>
Tue, 17 Feb 2015 06:12:19 +0000 (17:12 +1100)
committerCampbell Barton <ideasman42@gmail.com>
Tue, 17 Feb 2015 06:12:19 +0000 (17:12 +1100)
was writing past the buffer when inserting strokes

source/blender/blenkernel/intern/sketch.c

index f9c5e8fb07df37ad29071b832ff4e492c24a895e..0d355abb49b99edbe6f73f72f91952638d6b59ff 100644 (file)
@@ -196,14 +196,14 @@ void sk_appendStrokePoint(SK_Stroke *stk, SK_Point *pt)
 
 void sk_insertStrokePoints(SK_Stroke *stk, SK_Point *pts, int len, int start, int end)
 {
-       int size = end - start + 1;
+       int size = end - start;
 
        sk_growStrokeBufferN(stk, len - size);
 
        if (len != size) {
-               int tail_size = stk->nb_points - end + 1;
+               int tail_size = stk->nb_points - end;
 
-               memmove(stk->points + start + len, stk->points + end + 1, tail_size * sizeof(SK_Point));
+               memmove(stk->points + start + len, stk->points + end, tail_size * sizeof(SK_Point));
        }
 
        memcpy(stk->points + start, pts, len * sizeof(SK_Point));