[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [35410] trunk/blender/source/blender/ blenkernel/intern/brush.c: Prevent memory corruption when using fixed texture and fast strokes with

Sergey Sharybin g.ulairi at gmail.com
Tue Mar 8 21:31:46 CET 2011


Revision: 35410
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=35410
Author:   nazgul
Date:     2011-03-08 20:31:45 +0000 (Tue, 08 Mar 2011)
Log Message:
-----------
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.

Modified Paths:
--------------
    trunk/blender/source/blender/blenkernel/intern/brush.c

Modified: trunk/blender/source/blender/blenkernel/intern/brush.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/brush.c	2011-03-08 19:52:35 UTC (rev 35409)
+++ trunk/blender/source/blender/blenkernel/intern/brush.c	2011-03-08 20:31:45 UTC (rev 35410)
@@ -732,6 +732,12 @@
 
 	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;




More information about the Bf-blender-cvs mailing list