[gnumeric] CELL: Fix crash.



commit 0abf57874102e8aa792a45c5668847d5df983c9c
Author: Morten Welinder <terra gnome org>
Date:   Tue Apr 21 17:40:19 2020 -0400

    CELL: Fix crash.
    
    Calling this cell with an array constant didn't work.  It should not work,
    but it should also not crash.

 NEWS                        |  1 +
 plugins/fn-info/ChangeLog   |  5 +++++
 plugins/fn-info/functions.c | 10 ++++++++--
 3 files changed, 14 insertions(+), 2 deletions(-)
---
diff --git a/NEWS b/NEWS
index 91751c95b..2b15b04ef 100644
--- a/NEWS
+++ b/NEWS
@@ -8,6 +8,7 @@ Morten:
        * Improve error message [#472]
        * Impose ordering of ssconvert --export-graphs
        * Doc fixes.
+       * Fix CELL crash.  [#479]
 
 --------------------------------------------------------------------------
 Gnumeric 1.12.46
diff --git a/plugins/fn-info/ChangeLog b/plugins/fn-info/ChangeLog
index 734ac942d..0156e4496 100644
--- a/plugins/fn-info/ChangeLog
+++ b/plugins/fn-info/ChangeLog
@@ -1,3 +1,8 @@
+2020-04-21  Morten Welinder  <terra gnome org>
+
+       * functions.c (gnumeric_cell): Actually verify that we get a cell
+       range (and not an array constant).
+
 2019-11-06  Morten Welinder <terra gnome org>
 
        * Release 1.12.46
diff --git a/plugins/fn-info/functions.c b/plugins/fn-info/functions.c
index 3a218470a..cce38e13c 100644
--- a/plugins/fn-info/functions.c
+++ b/plugins/fn-info/functions.c
@@ -171,8 +171,14 @@ static GnmValue *
 gnumeric_cell (GnmFuncEvalInfo *ei, GnmValue const * const *argv)
 {
        char const *info_type = value_peek_string (argv[0]);
-       GnmCellRef const *ref = &argv [1]->v_range.cell.a;
-       const Sheet *sheet = eval_sheet (ref->sheet, ei->pos->sheet);
+       GnmCellRef const *ref;
+       const Sheet *sheet;
+
+       if (!VALUE_IS_CELLRANGE (argv[1]))
+               return value_new_error_VALUE (ei->pos);
+
+       ref = &argv[1]->v_range.cell.a;
+       sheet = eval_sheet (ref->sheet, ei->pos->sheet);
 
        /*
         * CELL translates its keywords (ick)


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