From b4c34b95c5418695afd11187c23b631d9ec93659 Mon Sep 17 00:00:00 2001 From: cedric Date: Mon, 18 Jan 2010 20:04:21 +0000 Subject: [PATCH] * evas: Fix segv source by checking result before using it. git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/evas@45301 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- src/lib/canvas/evas_object_textblock.c | 15 +++++++++++---- src/modules/loaders/eet/evas_image_load_eet.c | 8 ++++---- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/src/lib/canvas/evas_object_textblock.c b/src/lib/canvas/evas_object_textblock.c index e7ecc6d..fef961c 100644 --- a/src/lib/canvas/evas_object_textblock.c +++ b/src/lib/canvas/evas_object_textblock.c @@ -1944,8 +1944,13 @@ _layout_text_append(Ctxt *c, Evas_Object_Textblock_Format *fmt, Evas_Object_Text it = (Evas_Object_Textblock_Item *)(EINA_INLIST_GET(c->ln->items))->last; _layout_strip_trailing_whitespace(c, fmt, it); twrap = _layout_word_end(str, wrap); - ch = evas_common_font_utf8_get_next((unsigned char *)str, &twrap); - str = str + twrap; + if (twrap >= 0) + { + ch = evas_common_font_utf8_get_next((unsigned char *)str, &twrap); + str = str + twrap; + } + else + str = NULL; } } } @@ -1973,9 +1978,11 @@ _layout_text_append(Ctxt *c, Evas_Object_Textblock_Format *fmt, Evas_Object_Text wrap = 0; twrap = _layout_word_end(it->text, wrap); wrap = twrap; - ch = evas_common_font_utf8_get_next((unsigned char *)str, &wrap); if (twrap >= 0) - _layout_item_text_cutoff(c, it, twrap); + { + ch = evas_common_font_utf8_get_next((unsigned char *)str, &wrap); + _layout_item_text_cutoff(c, it, twrap); + } if (wrap > 0) str = str + wrap; else diff --git a/src/modules/loaders/eet/evas_image_load_eet.c b/src/modules/loaders/eet/evas_image_load_eet.c index 0e6407a..1d0d000 100644 --- a/src/modules/loaders/eet/evas_image_load_eet.c +++ b/src/modules/loaders/eet/evas_image_load_eet.c @@ -42,14 +42,14 @@ evas_image_load_file_head_eet(Image_Entry *ie, const char *file, const char *key } ok = eet_data_image_header_read(ef, key, &w, &h, &alpha, &compression, &quality, &lossy); - if (IMG_TOO_BIG(w, h)) + if (!ok) { - *error = EVAS_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED; + *error = EVAS_LOAD_ERROR_DOES_NOT_EXIST; goto on_error; } - if (!ok) + if (IMG_TOO_BIG(w, h)) { - *error = EVAS_LOAD_ERROR_DOES_NOT_EXIST; + *error = EVAS_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED; goto on_error; } if (alpha) ie->flags.alpha = 1; -- 2.7.4