[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [35594] trunk/blender/source/blender/imbuf /intern/scaling.c: bugfix [#26502] segmentationfault on pressing button to browse existing images for UV window

Campbell Barton ideasman42 at gmail.com
Thu Mar 17 12:08:26 CET 2011


Revision: 35594
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=35594
Author:   campbellbarton
Date:     2011-03-17 11:08:25 +0000 (Thu, 17 Mar 2011)
Log Message:
-----------
bugfix [#26502] segmentationfault on pressing button to browse existing images for UV window
really old one!, since initial commit blender would crash scaling down large sizes eg: 60962 -> 128 (width or height).

the problem is scaledownx/y doesn't check buffer endpoints, with really large images theres a loop on a float value which can fail with large image sizes.

previous commit added asserts if the buffer runs over (assuming it doesnt crash),
This commit changes an epsilon value, tested this with random small images as well as images over 200,000 px, and it works fine, this is still flakey though and for really really big images it probably still fails.

Modified Paths:
--------------
    trunk/blender/source/blender/imbuf/intern/scaling.c

Modified: trunk/blender/source/blender/imbuf/intern/scaling.c
===================================================================
--- trunk/blender/source/blender/imbuf/intern/scaling.c	2011-03-17 10:37:48 UTC (rev 35593)
+++ trunk/blender/source/blender/imbuf/intern/scaling.c	2011-03-17 11:08:25 UTC (rev 35594)
@@ -863,7 +863,7 @@
 		rectf_end= ibuf->rect_float + (ibuf->x * ibuf->y * sizeof(float) * 4);
 	}
 
-	add = (ibuf->x - 0.001) / newx;
+	add = (ibuf->x - 0.01) / newx;
 
 	if (do_rect) {
 		rect = (uchar *) ibuf->rect;
@@ -993,7 +993,7 @@
 		rectf_end= ibuf->rect_float + (ibuf->x * ibuf->y * sizeof(float) * 4);
 	}
 
-	add = (ibuf->y - 0.001) / newy;
+	add = (ibuf->y - 0.01) / newy;
 	skipx = 4 * ibuf->x;
 
 	for (x = skipx - 4; x>=0 ; x-= 4) {




More information about the Bf-blender-cvs mailing list