[gnumeric] xls: less criticals on corrupted files.



commit 323ad7680e84923d4ce09352e57e1a93aa3338f3
Author: Morten Welinder <terra gnome org>
Date:   Sat Nov 1 13:44:21 2014 -0400

    xls: less criticals on corrupted files.

 plugins/excel/ChangeLog       |    5 +++++
 plugins/excel/ms-excel-read.c |    1 +
 2 files changed, 6 insertions(+), 0 deletions(-)
---
diff --git a/plugins/excel/ChangeLog b/plugins/excel/ChangeLog
index 3a05728..2834d6b 100644
--- a/plugins/excel/ChangeLog
+++ b/plugins/excel/ChangeLog
@@ -1,3 +1,8 @@
+2014-11-01  Morten Welinder  <terra gnome org>
+
+       * ms-excel-read.c (excel_read_MULRK): Catch crazy column numbers
+       early.
+
 2014-10-30  Morten Welinder  <terra gnome org>
 
        * ms-excel-read.c (excel_font_get): In case of error, fall back to
diff --git a/plugins/excel/ms-excel-read.c b/plugins/excel/ms-excel-read.c
index 6425f2a..ceb8082 100644
--- a/plugins/excel/ms-excel-read.c
+++ b/plugins/excel/ms-excel-read.c
@@ -4730,6 +4730,7 @@ excel_read_MULRK (BiffQuery *q, ExcelReadSheet *esheet)
        lastcol = GSF_LE_GET_GUINT16 (q->data + q->length - 2);
 
        XL_CHECK_CONDITION (lastcol >= col);
+       XL_CHECK_CONDITION (lastcol < gnm_sheet_get_max_cols (esheet->sheet));
 
        if (q->length != 4 + 6 * (lastcol - col + 1) + 2) {
                int guess = col + (q->length - (4 + 2)) / 6 - 1;


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