[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [27990] trunk/blender/source/blender/ blenfont/intern/blf_font.c: added negative bounds checks so drawing text into a buffer wont crash.

Campbell Barton ideasman42 at gmail.com
Sun Apr 4 17:03:46 CEST 2010


Revision: 27990
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=27990
Author:   campbellbarton
Date:     2010-04-04 17:03:45 +0200 (Sun, 04 Apr 2010)

Log Message:
-----------
added negative bounds checks so drawing text into a buffer wont crash.

Modified Paths:
--------------
    trunk/blender/source/blender/blenfont/intern/blf_font.c

Modified: trunk/blender/source/blender/blenfont/intern/blf_font.c
===================================================================
--- trunk/blender/source/blender/blenfont/intern/blf_font.c	2010-04-04 14:52:15 UTC (rev 27989)
+++ trunk/blender/source/blender/blenfont/intern/blf_font.c	2010-04-04 15:03:45 UTC (rev 27990)
@@ -232,8 +232,8 @@
 			yb= g->pitch < 0 ? 0 : g->height-1;
 			
 			if (font->b_fbuf) {
-				for (y= 0; y < height_clip; y++) {
-					for (x= 0; x < width_clip; x++) {
+				for (y=(chy >= 0 ? 0:-chy); y < height_clip; y++) {
+					for (x=(chx >= 0 ? 0:-chx); x < width_clip; x++) {
 						
 						a= *(g->bitmap + x + (yb * g->pitch)) / 255.0f;
 





More information about the Bf-blender-cvs mailing list