[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Pspp-cvs] pspp/src/math coefficient.c ChangeLog
From: |
Jason H Stover |
Subject: |
[Pspp-cvs] pspp/src/math coefficient.c ChangeLog |
Date: |
Sat, 01 Mar 2008 20:53:00 +0000 |
CVSROOT: /sources/pspp
Module name: pspp
Changes by: Jason H Stover <jstover> 08/03/01 20:53:00
Modified files:
src/math : coefficient.c ChangeLog
Log message:
added checks for pointers to coefficient
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/pspp/src/math/coefficient.c?cvsroot=pspp&r1=1.10&r2=1.11
http://cvs.savannah.gnu.org/viewcvs/pspp/src/math/ChangeLog?cvsroot=pspp&r1=1.15&r2=1.16
Patches:
Index: coefficient.c
===================================================================
RCS file: /sources/pspp/pspp/src/math/coefficient.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -b -r1.10 -r1.11
--- coefficient.c 7 Jul 2007 06:14:22 -0000 1.10
+++ coefficient.c 1 Mar 2008 20:53:00 -0000 1.11
@@ -55,6 +55,7 @@
size_t i;
int n_vals = 1;
+ assert (c != NULL);
for (i = 0; i < X->m->size2; i++)
{
c[i] = xmalloc (sizeof (*c[i]));
@@ -182,7 +183,7 @@
pspp_linreg_get_coeff (const pspp_linreg_cache * c,
const struct variable *v, const union value *val)
{
- int i = 1;
+ int i;
struct pspp_coeff *result = NULL;
const struct variable *tmp = NULL;
@@ -194,7 +195,10 @@
{
return NULL;
}
-
+ /*
+ C->N_COEFFS == 1 means regression through the origin.
+ */
+ i = (c->n_coeffs > 1) ? 1 : 0;
result = c->coeff[i];
tmp = pspp_coeff_get_var (result, 0);
while (tmp != v && i < c->n_coeffs)
@@ -203,7 +207,7 @@
tmp = pspp_coeff_get_var (result, 0);
i++;
}
- if (i > c->n_coeffs)
+ if (i >= c->n_coeffs)
{
return NULL;
}
Index: ChangeLog
===================================================================
RCS file: /sources/pspp/pspp/src/math/ChangeLog,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -b -r1.15 -r1.16
--- ChangeLog 7 Jun 2007 06:42:05 -0000 1.15
+++ ChangeLog 1 Mar 2008 20:53:00 -0000 1.16
@@ -1,3 +1,12 @@
+2008-03-01 Jason Stover <address@hidden>
+
+ * coefficient.c (pspp_coeff_init): Ensure first arg is not a null
+ pointer.
+
+ * coefficient.c (pspp_linreg_get_coeff): Make sure we don't return
+ a result beyond the last coefficient, or start with a coefficient
+ beyond the last one if there is only one.
+
2007-06-06 Ben Pfaff <address@hidden>
Adapt case sources, sinks, and clients of procedure code to the
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Pspp-cvs] pspp/src/math coefficient.c ChangeLog,
Jason H Stover <=