forked from enlightenment/efl
patch up another out-of-bound text problem in textblock.
SVN revision: 70459
This commit is contained in:
parent
fb8f30b2ac
commit
797949633a
|
@ -5196,6 +5196,7 @@ evas_object_textblock_text_markup_get(const Evas_Object *obj)
|
||||||
Evas_Object_Textblock_Node_Format *fnode;
|
Evas_Object_Textblock_Node_Format *fnode;
|
||||||
Eina_Unicode *text_base, *text;
|
Eina_Unicode *text_base, *text;
|
||||||
int off;
|
int off;
|
||||||
|
size_t len;
|
||||||
|
|
||||||
/* For each text node to thorugh all of it's format nodes
|
/* For each text node to thorugh all of it's format nodes
|
||||||
* append text from the start to the offset of the next format
|
* 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.
|
* this is the core algorithm of the layout mechanism.
|
||||||
* Skip the unicode replacement chars when there are because
|
* Skip the unicode replacement chars when there are because
|
||||||
* we don't want to print them. */
|
* we don't want to print them. */
|
||||||
|
len = eina_ustrbuf_length_get(n->unicode);
|
||||||
text_base = text =
|
text_base = text =
|
||||||
eina_unicode_strndup(eina_ustrbuf_string_get(n->unicode),
|
eina_unicode_strndup(eina_ustrbuf_string_get(n->unicode), len);
|
||||||
eina_ustrbuf_length_get(n->unicode));
|
|
||||||
fnode = n->format_node;
|
fnode = n->format_node;
|
||||||
off = 0;
|
off = 0;
|
||||||
while (fnode && (fnode->text_node == n))
|
while (fnode && (fnode->text_node == n))
|
||||||
{
|
{
|
||||||
Eina_Unicode tmp_ch;
|
Eina_Unicode tmp_ch;
|
||||||
off += fnode->offset;
|
off += fnode->offset;
|
||||||
|
|
||||||
|
if (off > len) break;
|
||||||
/* No need to skip on the first run */
|
/* No need to skip on the first run */
|
||||||
tmp_ch = text[off];
|
tmp_ch = text[off];
|
||||||
text[off] = 0; /* Null terminate the part of the string */
|
text[off] = 0; /* Null terminate the part of the string */
|
||||||
|
|
Loading…
Reference in New Issue