[gnumeric] xls: attempt a fix for corrupted hash table.
- From: Morten Welinder <mortenw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnumeric] xls: attempt a fix for corrupted hash table.
- Date: Fri, 15 May 2015 15:20:38 +0000 (UTC)
commit 65fd6ad6825e1d35eb7baa15fc8f52073efc1e24
Author: Morten Welinder <terra gnome org>
Date: Fri May 15 11:20:13 2015 -0400
xls: attempt a fix for corrupted hash table.
NEWS | 1 +
plugins/excel/ChangeLog | 5 +++++
plugins/excel/ms-excel-read.c | 31 +++++++++++++++++--------------
3 files changed, 23 insertions(+), 14 deletions(-)
---
diff --git a/NEWS b/NEWS
index f8b6b25..c8ca296 100644
--- a/NEWS
+++ b/NEWS
@@ -17,6 +17,7 @@ Morten:
* Fuzzed file fixes. [#748595] [#748597] [#749031] [#749030]
[#749069] [#748533] [#749118] [#749166] [#749181] [#749184]
[#749236] [#749240] [#749234] [#749235] [#749271] [#749270]
+ [#749424]
* Make solver check linearity of model.
* Fix xls saving of marker style. [#749185]
* Make compilation with clang work again. [#749138]
diff --git a/plugins/excel/ChangeLog b/plugins/excel/ChangeLog
index bf9a73c..eb7ae2f 100644
--- a/plugins/excel/ChangeLog
+++ b/plugins/excel/ChangeLog
@@ -1,3 +1,8 @@
+2015-05-15 Morten Welinder <terra gnome org>
+
+ * ms-excel-read.c (excel_formula_shared): Catch duplicate shared
+ formulas for the same cell.
+
2015-05-14 Morten Welinder <terra gnome org>
* ms-excel-read.c (excel_read_FILEPASS): Constify.
diff --git a/plugins/excel/ms-excel-read.c b/plugins/excel/ms-excel-read.c
index 5b8cf6d..e9ea731 100644
--- a/plugins/excel/ms-excel-read.c
+++ b/plugins/excel/ms-excel-read.c
@@ -2771,7 +2771,6 @@ excel_formula_shared (BiffQuery *q, ExcelReadSheet *esheet, GnmCell *cell)
gboolean is_array;
GnmExprTop const *texpr;
guint8 const *data;
- XLSharedFormula *sf;
if (!ms_biff_query_peek_next (q, &opcode) ||
!(opcode == BIFF_SHRFMLA ||
@@ -2838,22 +2837,26 @@ excel_formula_shared (BiffQuery *q, ExcelReadSheet *esheet, GnmCell *cell)
data, data_len, array_data_len,
!is_array, NULL);
- sf = g_new (XLSharedFormula, 1);
+ if (g_hash_table_lookup (esheet->shared_formulae, &cell->pos)) {
+ g_printerr ("Duplicate shared formula for cell %s\n", cell_name (cell));
+ } else {
+ XLSharedFormula *sf = g_new (XLSharedFormula, 1);
- /* WARNING: Do NOT use the upper left corner as the hashkey.
- * For some bizzare reason XL appears to sometimes not
- * flag the formula as shared until later.
- * Use the location of the cell we are reading as the key.
- */
- sf->key = cell->pos;
- sf->is_array = is_array;
- sf->data = data_len > 0 ? g_memdup (data, data_len + array_data_len) : NULL;
- sf->data_len = data_len;
- sf->array_data_len = array_data_len;
+ /* WARNING: Do NOT use the upper left corner as the hashkey.
+ * For some bizzare reason XL appears to sometimes not
+ * flag the formula as shared until later.
+ * Use the location of the cell we are reading as the key.
+ */
+ sf->key = cell->pos;
+ sf->is_array = is_array;
+ sf->data = data_len > 0 ? g_memdup (data, data_len + array_data_len) : NULL;
+ sf->data_len = data_len;
+ sf->array_data_len = array_data_len;
- d (1, g_printerr ("Shared formula, extent %s\n", range_as_string (&r)););
+ d (1, g_printerr ("Shared formula, extent %s\n", range_as_string (&r)););
- g_hash_table_insert (esheet->shared_formulae, &sf->key, sf);
+ g_hash_table_insert (esheet->shared_formulae, &sf->key, sf);
+ }
g_return_val_if_fail (texpr != NULL, NULL);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]