elm_code: Fix invalid read of 1 byte
authorJean-Philippe Andre <jp.andre@samsung.com>
Wed, 17 May 2017 06:21:52 +0000 (15:21 +0900)
committerJean-Philippe Andre <jp.andre@samsung.com>
Wed, 17 May 2017 06:32:03 +0000 (15:32 +0900)
After end of string...

src/lib/elementary/elm_code_widget_text.c

index a06fb8a..afdff5e 100644 (file)
@@ -174,7 +174,9 @@ _elm_code_widget_line_text_position_for_column_get(Eo *obj, Elm_Code_Widget_Data
    while ((unsigned int) count <= column && index <= (int) line->length)
      {
         position = (unsigned int) index;
-        unicode = eina_unicode_utf8_next_get(chars, &index);
+        if (index < (int) line->length)
+          unicode = eina_unicode_utf8_next_get(chars, &index);
+        else return line->length;
 
         if (unicode == 0)
           return line->length;