Commit fc954d7a authored by Morten Welinder's avatar Morten Welinder Committed by Morten Welinder

Fix infinite loop and check fourth argument.

2005-02-02  Morten Welinder  <terra@gnome.org>

	* functions.c (gnumeric_substitute): Fix infinite loop and check
	fourth argument.
parent 07417fe4
......@@ -24,6 +24,7 @@ Morten:
* Improve search strategy for auto-completion.
* Fix crash for insert/delete column/row. [#165873]
* Fix text import crash. [#165617]
* Fix SUBSTITUTE. [#165996]
--------------------------------------------------------------------------
Gnumeric 1.4.2
......
2005-02-02 Morten Welinder <terra@gnome.org>
* functions.c (gnumeric_substitute): Fix infinite loop and check
fourth argument.
2005-01-17 Jody Goldberg <jody@gnome.org>
* Release 1.4.2
......
......@@ -956,9 +956,18 @@ gnumeric_substitute (FunctionEvalInfo *ei, GnmValue **argv)
char const *text = value_peek_string (argv[0]);
char const *old = value_peek_string (argv[1]);
char const *new = value_peek_string (argv[2]);
int num = argv[3] ? value_get_as_int (argv[3]) : 0;
int num = 0;
if (argv[3]) {
num = value_get_as_int (argv[3]);
if (num <= 0)
return value_new_error_VALUE (ei->pos);
}
oldlen = strlen (old);
if (oldlen == 0)
return value_dup (argv[0]);
newlen = strlen (new);
len = strlen (text);
s = g_string_sized_new (len);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment