Commit 5c7131b1 authored by Morten Welinder's avatar Morten Welinder Committed by Morten Welinder
Browse files

Fix handling of out-of-bounds segments. (gnumeric_trim): Fix the fix.

2006-01-20  Morten Welinder  <terra@gnome.org>

	* functions.c (gnumeric_mid): Fix handling of out-of-bounds
	segments.
	(gnumeric_trim): Fix the fix.
parent 83b2554f
......@@ -31,6 +31,7 @@ Morten:
* Fix font preference crash. [#326830]
* Fix memory allocation problem for writing charts.
* Fix loading of boolean constants from ods files.
* Fix MID for out-of-bounds values.
Jon Kåre:
* Hand clipboard off to clipboard manager when exiting.
......
2006-01-20 Morten Welinder <terra@gnome.org>
* functions.c (gnumeric_mid): Fix handling of out-of-bounds
segments.
(gnumeric_trim): Fix the fix.
2006-01-09 Morten Welinder <terra@gnome.org>
* functions.c (gnumeric_fixed): Use value_get_as_checked_bool.
......
......@@ -379,8 +379,11 @@ gnumeric_mid (FunctionEvalInfo *ei, GnmValue const * const *argv)
const char *upos;
size_t ilen, ipos, ulen;
if (len < 0 || pos < 1 || pos >= slen + 1)
if (len < 0 || pos < 1)
return value_new_error_VALUE (ei->pos);
if (pos >= slen + 1)
return value_new_string ("");
/* Make ipos zero-based. */
ipos = (size_t)(pos - 1);
ilen = (size_t)MIN (len, (gnm_float)(slen - ipos));
......@@ -914,7 +917,7 @@ gnumeric_trim (FunctionEvalInfo *ei, GnmValue const * const *argv)
}
if (space)
res->len = last_len;
g_string_truncate (res, last_len);
return value_new_string_nocopy (g_string_free (res, FALSE));
}
......
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