tasn pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=c48c9827ff89bd357834b0f6637922167c4bc17a
commit c48c9827ff89bd357834b0f6637922167c4bc17a Author: Youngbok Shin <[email protected]> Date: Wed Feb 5 13:23:55 2014 +0000 evas: textblock - Added Null checking in evas_textblock_text_markup_to_utf8 before calling eina_strbuf_append_length API. Summary: When input string has non-finished markup tags or escaped tags, eina_strbuf_append_length is called with Null string. There is a Null checking in eina_strbuf_* API, but it will print error message when input string is Null. Strictly speaking, *_markup_to_utf8 API could be used with any kind of input string. So, we need to add Null checking for removing the useless error message. Test Plan: Call the API like the following code. evas_textblock_text_markup_to_utf8(NULL, "test_text&&&&"); ERR message will be printed. Reviewers: woohyun, tasn, seoz, Hermet, hbr4570 CC: cedric Differential Revision: https://phab.enlightenment.org/D493 --- src/lib/evas/canvas/evas_object_textblock.c | 33 +++++++++++++++++++++++------ 1 file changed, 27 insertions(+), 6 deletions(-) diff --git a/src/lib/evas/canvas/evas_object_textblock.c b/src/lib/evas/canvas/evas_object_textblock.c index 4ea0e26..c2c1d06 100644 --- a/src/lib/evas/canvas/evas_object_textblock.c +++ b/src/lib/evas/canvas/evas_object_textblock.c @@ -6557,8 +6557,15 @@ evas_textblock_text_markup_to_utf8(const Evas_Object *eo_obj, const char *text) } else if (*p == 0) { - eina_strbuf_append_length(sbuf, s, p - s); - s = NULL; + if (s) + { + eina_strbuf_append_length(sbuf, s, p - s); + s = NULL; + } + else + { + ERR("There is a invalid markup tag. Please check the text."); + } } if (*p == 0) break; @@ -6571,8 +6578,15 @@ evas_textblock_text_markup_to_utf8(const Evas_Object *eo_obj, const char *text) * mark the start of the tag */ tag_start = p; tag_end = NULL; - eina_strbuf_append_length(sbuf, s, p - s); - s = NULL; + if (s) + { + eina_strbuf_append_length(sbuf, s, p - s); + s = NULL; + } + else + { + ERR("There is a invalid markup tag. Please check the text."); + } } } else if (*p == '>') @@ -6591,8 +6605,15 @@ evas_textblock_text_markup_to_utf8(const Evas_Object *eo_obj, const char *text) * the start of the escape sequence */ esc_start = p; esc_end = NULL; - eina_strbuf_append_length(sbuf, s, p - s); - s = NULL; + if (s) + { + eina_strbuf_append_length(sbuf, s, p - s); + s = NULL; + } + else + { + ERR("There is a invalid markup tag. Please check the text."); + } } } else if (*p == ';') --
