[evolution/gnome-3-30] Event with empty summary can cause crash



commit db8a5acda0a2931bf1a8111e9a06bccee3dba701
Author: Milan Crha <mcrha redhat com>
Date:   Mon Jan 7 14:31:26 2019 +0100

    Event with empty summary can cause crash
    
    In case libical is compiled to keep properties with empty values,
    which means icalproperty_get_xxxx() can return NULL instead of an empty
    string, the code of the ECellText (aka the List View) could try
    to use the NULL value in strcmp(), strlen() and such, which causes
    abort of the application.
    
    This had been reported downstream as:
    https://bugzilla.redhat.com/show_bug.cgi?id=1658002

 src/calendar/gui/e-cal-model.c | 2 +-
 src/e-util/e-cell-text.c       | 8 ++++----
 2 files changed, 5 insertions(+), 5 deletions(-)
---
diff --git a/src/calendar/gui/e-cal-model.c b/src/calendar/gui/e-cal-model.c
index 7706d2255d..f2e4266a7c 100644
--- a/src/calendar/gui/e-cal-model.c
+++ b/src/calendar/gui/e-cal-model.c
@@ -436,7 +436,7 @@ get_summary (ECalModelComponent *comp_data)
        icalproperty *prop;
 
        prop = icalcomponent_get_first_property (comp_data->icalcomp, ICAL_SUMMARY_PROPERTY);
-       if (prop)
+       if (prop && icalproperty_get_summary (prop))
                return g_strdup (icalproperty_get_summary (prop));
 
        return g_strdup ("");
diff --git a/src/e-util/e-cell-text.c b/src/e-util/e-cell-text.c
index 6366fc1088..d12646ae56 100644
--- a/src/e-util/e-cell-text.c
+++ b/src/e-util/e-cell-text.c
@@ -307,7 +307,7 @@ ect_stop_editing (ECellTextView *text_view,
                ECellView *ecell_view = (ECellView *) text_view;
                ECellText *ect = (ECellText *) ecell_view->ecell;
 
-               if (strcmp (old_text, text)) {
+               if (g_strcmp0 (old_text, text)) {
                        e_cell_text_set_value (
                                ect, ecell_view->e_table_model,
                                model_col, row, text);
@@ -628,7 +628,7 @@ generate_layout (ECellTextView *text_view,
 
        if (row >= 0) {
                gchar *temp = e_cell_text_get_text (ect, ecell_view->e_table_model, model_col, row);
-               layout = build_layout (text_view, row, temp ? temp : "?", width);
+               layout = build_layout (text_view, row, temp ? temp : "", width);
                e_cell_text_free_text (ect, ecell_view->e_table_model, model_col, temp);
        } else
                layout = build_layout (text_view, row, "Mumbo Jumbo", width);
@@ -807,7 +807,7 @@ ect_draw (ECellView *ecell_view,
        layout = generate_layout (text_view, model_col, view_col, row, x2 - x1);
 
        if (edit && edit->view_col == view_col && edit->row == row) {
-               layout = layout_with_preedit  (text_view, row, edit->text ? edit->text : "?",  x2 - x1);
+               layout = layout_with_preedit  (text_view, row, edit->text ? edit->text : "",  x2 - x1);
        }
 
        cairo_move_to (cr, x_origin, y_origin);
@@ -1210,7 +1210,7 @@ ect_enter_edit (ECellView *ecell_view,
        edit->default_cursor_shown = TRUE;
 
        temp = e_cell_text_get_text (ect, ecell_view->e_table_model, model_col, row);
-       edit->old_text = g_strdup (temp);
+       edit->old_text = g_strdup (temp ? temp : "");
        e_cell_text_free_text (ect, ecell_view->e_table_model, model_col, temp);
        edit->text = g_strdup (edit->old_text);
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]