[gnumeric] Style conditions: fix validator.



commit 6c0481316442a23e49a540b73f5f2421617daf8b
Author: Morten Welinder <terra gnome org>
Date:   Wed Jun 26 18:57:18 2013 -0400

    Style conditions: fix validator.

 ChangeLog              |    5 +++++
 NEWS                   |    1 +
 src/style-conditions.c |    5 ++++-
 3 files changed, 10 insertions(+), 1 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 4f08c58..a881662 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2013-06-26  Morten Welinder  <terra gnome org>
+
+       * src/style-conditions.c (gnm_style_cond_is_valid): Check sanity
+       of ->op before using it.  Fixes #703143.
+
 2013-06-26  Jean Brefort  <jean brefort normalesup org>
 
        * src/gnm-so-path.c (gnm_so_path_new_view): return NULL if there is no path.
diff --git a/NEWS b/NEWS
index eb09e6b..4401d4c 100644
--- a/NEWS
+++ b/NEWS
@@ -10,6 +10,7 @@ Jean:
 
 Morten:
        * Improve accuracy for 2-argument ERF.
+       * Fix crashes on corrupted files.  [#703143]
 
 --------------------------------------------------------------------------
 Gnumeric 1.12.3
diff --git a/src/style-conditions.c b/src/style-conditions.c
index 07c00e6..3db120b 100644
--- a/src/style-conditions.c
+++ b/src/style-conditions.c
@@ -101,7 +101,10 @@ gnm_style_cond_is_valid (GnmStyleCond const *cond)
 
        g_return_val_if_fail (cond != NULL, FALSE);
 
-       if (cond->overlay == NULL) return FALSE;
+       if (cond->overlay == NULL)
+               return FALSE;
+       if ((unsigned)cond->op > (unsigned)GNM_STYLE_COND_NOT_CONTAINS_BLANKS)
+               return FALSE;
 
        N = gnm_style_cond_op_operands (cond->op);
        for (ui = 0; ui < G_N_ELEMENTS (cond->deps); ui++) {


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