[gnumeric] deps: ignore excess function args.



commit 30c540dac69f319175ccf825a7a6dd89bed89861
Author: Morten Welinder <terra gnome org>
Date:   Mon Oct 4 21:27:17 2021 -0400

    deps: ignore excess function args.

 ChangeLog       | 4 ++++
 src/dependent.c | 5 ++++-
 2 files changed, 8 insertions(+), 1 deletion(-)
---
diff --git a/ChangeLog b/ChangeLog
index b184c7e38..6d52ace88 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2021-10-04  Morten Welinder  <terra gnome org>
+
+       * src/dependent.c (link_unlink_funcall): Ignore excess arguments.
+
 2021-09-25  Jean Brefort  <jean brefort normalesup org>
 
        * src/graph.c (gnm_go_data_vector_load_values): make sure that the
diff --git a/src/dependent.c b/src/dependent.c
index 95e68ab99..9ba25c6c7 100644
--- a/src/dependent.c
+++ b/src/dependent.c
@@ -1205,6 +1205,7 @@ link_unlink_funcall (GnmEvalPos *ep, GnmExprFunction const *call, DepLinkFlags f
        GnmFuncEvalInfo fei;
        GnmDependentFlags flag;
        DepLinkFlags pass = (flags & (DEP_LINK_LINK | DEP_LINK_UNLINK));
+       int amin, amax;
 
        gnm_func_load_if_stub (call->func);
        fei.pos = ep;
@@ -1213,7 +1214,9 @@ link_unlink_funcall (GnmEvalPos *ep, GnmExprFunction const *call, DepLinkFlags f
        if (flag & DEPENDENT_IGNORE_ARGS)
                return (flag & ~DEPENDENT_IGNORE_ARGS);
 
-       for (i = 0; i < call->argc; i++) {
+       gnm_func_count_args (call->func, &amin, &amax);
+
+       for (i = 0; i < call->argc && i < amax; i++) {
                char t = gnm_func_get_arg_type (call->func, i);
                DepLinkFlags extra =
                        (t == 'A' || t == 'r' || t == '?')


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