[gnumeric] Database functions: don't crash when given array database.
- From: Morten Welinder <mortenw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnumeric] Database functions: don't crash when given array database.
- Date: Tue, 23 Jun 2015 17:40:29 +0000 (UTC)
commit 0a0056a10527468813e92b10ef16092a7482e5b3
Author: Morten Welinder <terra gnome org>
Date: Tue Jun 23 13:39:11 2015 -0400
Database functions: don't crash when given array database.
This doesn't make it work either, but it looks like Excel does not allow
that so we're probably ok.
NEWS | 1 +
plugins/fn-database/ChangeLog | 5 +++++
plugins/fn-database/functions.c | 9 +++++----
3 files changed, 11 insertions(+), 4 deletions(-)
---
diff --git a/NEWS b/NEWS
index 6426373..46f28ce 100644
--- a/NEWS
+++ b/NEWS
@@ -36,6 +36,7 @@ Morten:
* Fix xls save problem with characters outside codepage. [#750856]
* Fix named expression problem. [#751056]
* Fix xlsx namespace problem. [#751120]
+ * Protect database functions against malformed database. [#751392]
--------------------------------------------------------------------------
Gnumeric 1.12.22
diff --git a/plugins/fn-database/ChangeLog b/plugins/fn-database/ChangeLog
index 89c5657..972d080 100644
--- a/plugins/fn-database/ChangeLog
+++ b/plugins/fn-database/ChangeLog
@@ -1,3 +1,8 @@
+2015-06-23 Morten Welinder <terra gnome org>
+
+ * functions.c (database_value_range_function): Database must be a
+ cell range. Fixes #751392.
+
2015-04-16 Morten Welinder <terra gnome org>
* Release 1.12.22
diff --git a/plugins/fn-database/functions.c b/plugins/fn-database/functions.c
index 9841cb1..c24cf03 100644
--- a/plugins/fn-database/functions.c
+++ b/plugins/fn-database/functions.c
@@ -279,12 +279,13 @@ database_value_range_function (GnmFuncEvalInfo *ei,
GnmValue **vals = NULL;
GnmValue *res;
- fieldno = find_column_of_field (ei->pos, database, field);
- if (fieldno < 0)
+ /* I don't like this -- minimal fix for now. 509427 and 751392. */
+ if (!VALUE_IS_CELLRANGE (criteria) ||
+ !VALUE_IS_CELLRANGE (database))
return value_new_error_NUM (ei->pos);
- /* I don't like this -- minimal fix for now. 509427. */
- if (!VALUE_IS_CELLRANGE (criteria))
+ fieldno = find_column_of_field (ei->pos, database, field);
+ if (fieldno < 0)
return value_new_error_NUM (ei->pos);
criterias = parse_database_criteria (ei->pos, database, criteria);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]