ajwillia-ms pushed a commit to branch master.

http://git.enlightenment.org/tools/edi.git/commit/?id=f0cc459a550c5bc239b2fc6e4931d33e7b8f9891

commit f0cc459a550c5bc239b2fc6e4931d33e7b8f9891
Author: Andy Williams <a...@andywilliams.me>
Date:   Sun Aug 23 23:23:07 2015 +0100

    Fix some bad memory access during widget creation
---
 elm_code/src/lib/widget/elm_code_widget.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/elm_code/src/lib/widget/elm_code_widget.c 
b/elm_code/src/lib/widget/elm_code_widget.c
index 0fd9479..fe6430e 100644
--- a/elm_code/src/lib/widget/elm_code_widget.c
+++ b/elm_code/src/lib/widget/elm_code_widget.c
@@ -207,7 +207,7 @@ _elm_code_widget_fill_line_tokens(Elm_Code_Widget *widget, 
Evas_Textgrid_Cell *c
 
 static void
 _elm_code_widget_fill_gutter(Elm_Code_Widget *widget, Evas_Textgrid_Cell 
*cells,
-                             Elm_Code_Status_Type status, int line)
+                             int width, Elm_Code_Status_Type status, int line)
 {
    char *number = NULL;
    int w, gutter, g;
@@ -216,6 +216,8 @@ _elm_code_widget_fill_gutter(Elm_Code_Widget *widget, 
Evas_Textgrid_Cell *cells,
    pd = eo_data_scope_get(widget, ELM_CODE_WIDGET_CLASS);
    gutter = elm_code_widget_text_left_gutter_width_get(widget);
 
+   if (width < gutter)
+     return;
    evas_object_textgrid_size_get(pd->grid, &w, NULL);
 
    cells[gutter-1].codepoint = status_icons[status];
@@ -334,7 +336,7 @@ _elm_code_widget_fill_line(Elm_Code_Widget *widget, 
Elm_Code_Line *line)
    evas_object_textgrid_size_get(pd->grid, &w, NULL);
    cells = evas_object_textgrid_cellrow_get(pd->grid, line->number - 1);
 
-   _elm_code_widget_fill_gutter(widget, cells, line->status, line->number);
+   _elm_code_widget_fill_gutter(widget, cells, w, line->status, line->number);
    _elm_code_widget_fill_line_tokens(widget, cells, w, line);
 
    length = elm_code_widget_line_text_column_width_get(widget, line);
@@ -386,7 +388,7 @@ _elm_code_widget_empty_line(Elm_Code_Widget *widget, 
unsigned int number)
 
    evas_object_textgrid_size_get(pd->grid, &w, NULL);
    cells = evas_object_textgrid_cellrow_get(pd->grid, number - 1);
-   _elm_code_widget_fill_gutter(widget, cells, ELM_CODE_STATUS_TYPE_DEFAULT, 
0);
+   _elm_code_widget_fill_gutter(widget, cells, w, 
ELM_CODE_STATUS_TYPE_DEFAULT, 0);
 
    for (x = gutter; x < (unsigned int) w; x++)
      {

-- 


Reply via email to