Fix #20233: crash when entering - characters in text object, with short
authorBrecht Van Lommel <brechtvanlommel@pandora.be>
Mon, 14 Dec 2009 20:01:52 +0000 (20:01 +0000)
committerBrecht Van Lommel <brechtvanlommel@pandora.be>
Mon, 14 Dec 2009 20:01:52 +0000 (20:01 +0000)
textbox width. I can't tell if this is working correct, the code is very
cryptic, with gotos even, but seems there is not enough space allocated
to permit splitting each character to it's own line.

source/blender/blenkernel/intern/font.c

index e2dccf02b40f689ee40bf9832ea83a9bc6173b1a..1a63f97e31085ecf8fe621140b6dbe9bd0d306a9 100644 (file)
@@ -705,10 +705,10 @@ struct chartrans *BKE_text_to_curve(Scene *scene, Object *ob, int mode)
 
        /* We assume the worst case: 1 character per line (is freed at end anyway) */
 
-       linedata= MEM_mallocN(sizeof(float)*(slen+2),"buildtext2");
-       linedata2= MEM_mallocN(sizeof(float)*(slen+2),"buildtext3");
-       linedata3= MEM_callocN(sizeof(float)*(slen+2),"buildtext4");    
-       linedata4= MEM_callocN(sizeof(float)*(slen+2),"buildtext5");            
+       linedata= MEM_mallocN(sizeof(float)*(slen*2 + 1),"buildtext2");
+       linedata2= MEM_mallocN(sizeof(float)*(slen*2 + 1),"buildtext3");
+       linedata3= MEM_callocN(sizeof(float)*(slen*2 + 1),"buildtext4");        
+       linedata4= MEM_callocN(sizeof(float)*(slen*2 + 1),"buildtext5");                
        
        linedist= cu->linedist;