elm_code: Fix crash on tabs in long lines
authorAndy Williams <andy@andywilliams.me>
Thu, 18 May 2017 23:01:23 +0000 (00:01 +0100)
committerAndy Williams <andy@andywilliams.me>
Thu, 18 May 2017 23:01:23 +0000 (00:01 +0100)
@fix

src/lib/elementary/elm_code_widget.c

index e53f93b..ed18da2 100644 (file)
@@ -362,7 +362,7 @@ _elm_code_widget_fill_line(Elm_Code_Widget *widget, Elm_Code_Line *line)
         charwidth = 1;
         if (unichr == '\t')
           charwidth = elm_code_widget_text_tabwidth_at_column_get(widget, x - gutter + 1);
-        for (i = x + 1; i < x + charwidth; i++)
+        for (i = x + 1; i < x + charwidth && i < (unsigned int) w; i++)
           {
              cells[i].codepoint = 0;
              cells[i].bg = _elm_code_widget_status_type_get(widget, line, i - gutter + 1);