Commit 3669a0bb authored by Morten Welinder's avatar Morten Welinder

MULTINOMIAL: Add range check.

Barf of insanely large values.
parent aa15dbb7
2013-05-14 Morten Welinder <terra@gnome.org>
* src/rangefunc.c (gnm_range_multinomial): Add range check.
(gnm_range_geometric_mean): Handle two FIXMEs.
2013-05-13 Morten Welinder <terra@gnome.org>
* src/*.c: Mark gobject property strings as P_(...).
......
......@@ -273,11 +273,9 @@ gnm_range_geometric_mean (gnm_float const *xs, int n, gnm_float *res)
int exp2;
gboolean zerop, anynegp;
/* FIXME: check empty case. */
if (n < 1)
return 1;
/* FIXME: check zero case. */
product_helper (xs, n, res, &exp2, &zerop, &anynegp);
if (zerop || anynegp)
return 1;
......@@ -321,7 +319,7 @@ gnm_range_multinomial (gnm_float const *xs, int n, gnm_float *res)
gnm_float x = xs[i];
int xi;
if (x < 0)
if (x < 0 || x > INT_MAX)
return 1;
xi = (int)x;
......
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