diff options
author | tlatorre <tlatorre@uchicago.edu> | 2018-09-17 08:56:18 -0500 |
---|---|---|
committer | tlatorre <tlatorre@uchicago.edu> | 2018-09-17 08:56:18 -0500 |
commit | ef3fac58f9342d98b1f86e00c4dcb1dbbbe9f1a8 (patch) | |
tree | a54f53a071254523291ed3122f49b31e73d846ae | |
parent | e1bbfc7ef85800f0e0f5e422bdef3b55d88e597e (diff) | |
download | sddm-ef3fac58f9342d98b1f86e00c4dcb1dbbbe9f1a8.tar.gz sddm-ef3fac58f9342d98b1f86e00c4dcb1dbbbe9f1a8.tar.bz2 sddm-ef3fac58f9342d98b1f86e00c4dcb1dbbbe9f1a8.zip |
fix a bug in interp1d()
This commit fixes a bug in interp1d() which would cause the function to read
past the end of the arrays if the interpolation point was equal to the last
point in the xp array.
-rw-r--r-- | src/misc.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -269,8 +269,8 @@ double interp1d(double x, double *xp, double *yp, size_t n) * If x < xp[0] returns yp[0] and if x > xp[n-1] returns yp[n-1]. */ size_t i; - if (x < xp[0]) return yp[0]; - if (x > xp[n-1]) return yp[n-1]; + if (x <= xp[0]) return yp[0]; + if (x >= xp[n-1]) return yp[n-1]; i = (x-xp[0])/(xp[1]-xp[0]); |