From a193b14c2514e93949773cb1e65462baa68d3349 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Tue, 8 Mar 2011 20:31:45 +0000 Subject: Prevent memory corruption when using fixed texture and fast strokes with big spacing. Not sure if it's the best solution or it should be fixed when calculating new areas. It'll be cool if somebody else familiar with this area will check this. --- source/blender/blenkernel/intern/brush.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'source/blender/blenkernel/intern/brush.c') diff --git a/source/blender/blenkernel/intern/brush.c b/source/blender/blenkernel/intern/brush.c index 6e9c383f2a6..869123de97f 100644 --- a/source/blender/blenkernel/intern/brush.c +++ b/source/blender/blenkernel/intern/brush.c @@ -732,6 +732,12 @@ static void brush_painter_do_partial(BrushPainter *painter, ImBuf *oldtexibuf, i dotexold = (oldtexibuf != NULL); + /* not sure if it's actually needed or it's a mistake in coords/sizes + calculation in brush_painter_fixed_tex_partial_update(), but without this + limitation memory gets corrupted at fast strokes with quite big spacing (sergey) */ + w = MIN2(w, ibuf->x); + h = MIN2(h, ibuf->y); + if (painter->cache.flt) { for (; y < h; y++) { bf = ibuf->rect_float + (y*ibuf->x + origx)*4; -- cgit v1.2.3