From: raster Date: Wed, 25 Apr 2012 08:34:06 +0000 (+0000) Subject: patch up another out-of-bound text problem in textblock. X-Git-Tag: submit/trunk/20120815.174732~408 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=518453c06c3709fd248672b3035df3183cd34760;p=profile%2Fivi%2Fevas.git patch up another out-of-bound text problem in textblock. git-svn-id: http://svn.enlightenment.org/svn/e/trunk/evas@70459 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- diff --git a/src/lib/canvas/evas_object_textblock.c b/src/lib/canvas/evas_object_textblock.c index 1c171c9..ee1b105 100644 --- a/src/lib/canvas/evas_object_textblock.c +++ b/src/lib/canvas/evas_object_textblock.c @@ -5196,6 +5196,7 @@ evas_object_textblock_text_markup_get(const Evas_Object *obj) Evas_Object_Textblock_Node_Format *fnode; Eina_Unicode *text_base, *text; int off; + size_t len; /* For each text node to thorugh all of it's format nodes * append text from the start to the offset of the next format @@ -5203,15 +5204,17 @@ evas_object_textblock_text_markup_get(const Evas_Object *obj) * this is the core algorithm of the layout mechanism. * Skip the unicode replacement chars when there are because * we don't want to print them. */ + len = eina_ustrbuf_length_get(n->unicode); text_base = text = - eina_unicode_strndup(eina_ustrbuf_string_get(n->unicode), - eina_ustrbuf_length_get(n->unicode)); + eina_unicode_strndup(eina_ustrbuf_string_get(n->unicode), len); fnode = n->format_node; off = 0; while (fnode && (fnode->text_node == n)) { Eina_Unicode tmp_ch; off += fnode->offset; + + if (off > len) break; /* No need to skip on the first run */ tmp_ch = text[off]; text[off] = 0; /* Null terminate the part of the string */