[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [20893] branches/blender2.5/blender/source /blender: 2.5

Ton Roosendaal ton at blender.org
Mon Jun 15 11:54:37 CEST 2009


Revision: 20893
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=20893
Author:   ton
Date:     2009-06-15 11:54:37 +0200 (Mon, 15 Jun 2009)

Log Message:
-----------
2.5

Text Object: editmode suffered wrong allocation and reading from wrong
memory, causing crashes when typing more than a few chars.

Modified Paths:
--------------
    branches/blender2.5/blender/source/blender/blenkernel/intern/curve.c
    branches/blender2.5/blender/source/blender/blenkernel/intern/font.c
    branches/blender2.5/blender/source/blender/editors/curve/editfont.c

Modified: branches/blender2.5/blender/source/blender/blenkernel/intern/curve.c
===================================================================
--- branches/blender2.5/blender/source/blender/blenkernel/intern/curve.c	2009-06-15 09:26:31 UTC (rev 20892)
+++ branches/blender2.5/blender/source/blender/blenkernel/intern/curve.c	2009-06-15 09:54:37 UTC (rev 20893)
@@ -155,7 +155,7 @@
 		cu->str= MEM_mallocN(12, "str");
 		strcpy(cu->str, "Text");
 		cu->pos= 4;
-		cu->strinfo= MEM_callocN(12*sizeof(CharInfo), "strinfo");
+		cu->strinfo= MEM_callocN(12*sizeof(CharInfo), "strinfo new");
 		cu->totbox= cu->actbox= 1;
 		cu->tb= MEM_callocN(MAXTEXTBOX*sizeof(TextBox), "textbox");
 		cu->tb[0].w = cu->tb[0].h = 0.0;

Modified: branches/blender2.5/blender/source/blender/blenkernel/intern/font.c
===================================================================
--- branches/blender2.5/blender/source/blender/blenkernel/intern/font.c	2009-06-15 09:26:31 UTC (rev 20892)
+++ branches/blender2.5/blender/source/blender/blenkernel/intern/font.c	2009-06-15 09:54:37 UTC (rev 20893)
@@ -682,7 +682,7 @@
 		cu->ulheight = 0.05;
 	
 	if (cu->strinfo==NULL)	/* old file */
-		cu->strinfo = MEM_callocN((slen+1) * sizeof(CharInfo), "strinfo compat");
+		cu->strinfo = MEM_callocN((slen+4) * sizeof(CharInfo), "strinfo compat");
 	
 	custrinfo= cu->strinfo;
 	if (cu->editfont)
@@ -1145,7 +1145,7 @@
 		if (cu->sepchar==0) {
 			for (i= 0; i<slen; i++) {
 				cha = (uintptr_t) mem[i];
-				info = &(cu->strinfo[i]);
+				info = &(custrinfo[i]);
 				if (info->mat_nr > (ob->totcol)) {
 					/* printf("Error: Illegal material index (%d) in text object, setting to 0\n", info->mat_nr); */
 					info->mat_nr = 0;

Modified: branches/blender2.5/blender/source/blender/editors/curve/editfont.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/curve/editfont.c	2009-06-15 09:26:31 UTC (rev 20892)
+++ branches/blender2.5/blender/source/blender/editors/curve/editfont.c	2009-06-15 09:54:37 UTC (rev 20893)
@@ -1407,7 +1407,7 @@
 		ef->copybuf= MEM_callocN((MAXTEXT+4)*sizeof(wchar_t), "texteditcopybuf");
 		ef->copybufinfo= MEM_callocN((MAXTEXT+4)*sizeof(CharInfo), "texteditcopybufinfo");	
 		ef->oldstr= MEM_callocN((MAXTEXT+4)*sizeof(wchar_t), "oldstrbuf");
-		ef->oldstrinfo= MEM_callocN((MAXTEXT+4)*sizeof(wchar_t), "oldstrbuf");
+		ef->oldstrinfo= MEM_callocN((MAXTEXT+4)*sizeof(CharInfo), "oldstrbuf");
 	}
 	
 	// Convert the original text to wchar_t





More information about the Bf-blender-cvs mailing list