[gnumeric] MULTINOMIAL: Add range check.
- From: Morten Welinder <mortenw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnumeric] MULTINOMIAL: Add range check.
- Date: Tue, 14 May 2013 13:31:49 +0000 (UTC)
commit 3669a0bbe63f0555c9e9cd8ea826629631b54537
Author: Morten Welinder <terra gnome org>
Date: Tue May 14 09:31:23 2013 -0400
MULTINOMIAL: Add range check.
Barf of insanely large values.
ChangeLog | 5 +++++
src/rangefunc.c | 4 +---
2 files changed, 6 insertions(+), 3 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index df77836..4972400 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+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_(...).
diff --git a/src/rangefunc.c b/src/rangefunc.c
index 2a36a72..2eab119 100644
--- a/src/rangefunc.c
+++ b/src/rangefunc.c
@@ -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;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]