ecore_imf/wayland: fix infinite loop bug when ibus-hangul is used
authorJihoon Kim <jihoon48.kim@samsung.com>
Wed, 8 Oct 2014 05:24:14 +0000 (14:24 +0900)
committerJihoon Kim <jihoon48.kim@samsung.com>
Wed, 8 Oct 2014 05:24:14 +0000 (14:24 +0900)
When korean language was typed with ibus-hangul,
wayland immodule falled into the infinite loop.

src/modules/ecore_imf/wayland/wayland_imcontext.c

index a83b493..70b8cab 100644 (file)
@@ -82,6 +82,14 @@ utf8_offset_to_characters(const char *str, int offset)
 {
    int index = 0;
    unsigned int i = 0;
+   int len = 0;
+
+   if (!str) return 0;
+
+   len = strlen(str);
+
+   if (offset > len)
+     offset = len;
 
    for (; index < offset; i++)
      eina_unicode_utf8_next_get(str, &index);