[gnumeric] Database: don't allow array databases.



commit d744f379d3bafc3bfdc5bcc120f0d4310fffc0d3
Author: Morten Welinder <terra gnome org>
Date:   Sat Jan 30 12:28:37 2016 -0500

    Database: don't allow array databases.
    
    The code clearly wants a cell range.  That may not be right, but peeking
    into random memory based on the wrong struct layout isn't the solution.

 ChangeLog   |    5 +++++
 NEWS        |    1 +
 src/value.c |    5 +++++
 3 files changed, 11 insertions(+), 0 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 8223092..f6b2ccc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2016-01-30  Morten Welinder  <terra gnome org>
+
+       * src/value.c (find_column_of_field): Insist that the database be
+       a cell range, not an array.
+
 2016-01-29  Morten Welinder  <terra gnome org>
 
        * src/sf-bessel.c (gnm_bessel_i): Use series for small x.
diff --git a/NEWS b/NEWS
index af291cc..b484c3e 100644
--- a/NEWS
+++ b/NEWS
@@ -24,6 +24,7 @@ Morten:
        * Work around gtk+ bug causing growing windows.  [#761142]
        * Improve BESSELJ and BESSELY.
        * Improve BETA accuracy.
+       * Fix problem with database functions.  [#761305]
 
 --------------------------------------------------------------------------
 Gnumeric 1.12.26
diff --git a/src/value.c b/src/value.c
index 9499a50..88de916 100644
--- a/src/value.c
+++ b/src/value.c
@@ -1676,6 +1676,11 @@ find_column_of_field (GnmEvalPos const *ep,
        int   begin_col, end_col, row, n, column;
        int   offset;
 
+       // I'm not certain we shoul demand this, but the code clearly wants
+       // it.
+       if (!VALUE_IS_CELLRANGE (database))
+               return -1;
+
        offset = database->v_range.cell.a.col;
 
        if (VALUE_IS_FLOAT (field))


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