Test whether referenced column exists when loading ETableState

This could lead to a crash as here:
https://bugzilla.gnome.org/show_bug.cgi?id=675286#c1
This commit is contained in:
Milan Crha
2019-06-28 12:39:36 +02:00
parent 14aef61c84
commit 1ae0f96a16

View File

@ -528,9 +528,13 @@ e_table_state_load_from_node (ETableState *state,
for (; children; children = children->next) {
if (!strcmp ((gchar *) children->name, "column")) {
int_and_double *column_info = g_new (int_and_double, 1);
gint column_source;
column_info->column = e_xml_get_integer_prop_by_name (
children, (const guchar *)"source");
column_source = e_xml_get_integer_prop_by_name (children, (const guchar *) "source");
if (column_source < 0 || column_source >= columns->len)
continue;
column_info->column = column_source;
column_info->expansion =
e_xml_get_double_prop_by_name_with_default (
children, (const guchar *)"expansion", 1);