aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNiclas Zeising <zeising@FreeBSD.org>2019-10-30 22:23:50 +0000
committerNiclas Zeising <zeising@FreeBSD.org>2019-10-30 22:23:50 +0000
commit4393d57c929b74b5841db1b6e1b34e27c8fefb36 (patch)
tree6cba5529fa7e8faa703921f64a8c565c63fdb57b
parentdc8507943df25de303ea045261dee83ac549b04e (diff)
downloadports-4393d57c929b74b5841db1b6e1b34e27c8fefb36.tar.gz
ports-4393d57c929b74b5841db1b6e1b34e27c8fefb36.zip
Notes
-rw-r--r--databases/rrdtool/Makefile1
-rw-r--r--databases/rrdtool/files/patch-src_rrd__rpncalc.c29
2 files changed, 30 insertions, 0 deletions
diff --git a/databases/rrdtool/Makefile b/databases/rrdtool/Makefile
index e0ffced913f7..0e51afd1d90c 100644
--- a/databases/rrdtool/Makefile
+++ b/databases/rrdtool/Makefile
@@ -3,6 +3,7 @@
PORTNAME= rrdtool
PORTVERSION= 1.7.2
+PORTREVISION= 1
CATEGORIES= databases graphics
MASTER_SITES= http://oss.oetiker.ch/rrdtool/pub/
diff --git a/databases/rrdtool/files/patch-src_rrd__rpncalc.c b/databases/rrdtool/files/patch-src_rrd__rpncalc.c
new file mode 100644
index 000000000000..3a093028da16
--- /dev/null
+++ b/databases/rrdtool/files/patch-src_rrd__rpncalc.c
@@ -0,0 +1,29 @@
+Fix UB when calculating median of all-NaN values
+
+Corresponds to upstream commit 1d700bf
+
+https://github.com/oetiker/rrdtool-1.x/commit/1d700bf3ba13a75b91047e6e979231abd755892b
+
+--- src/rrd_rpncalc.c.orig 2019-05-27 18:48:09 UTC
++++ src/rrd_rpncalc.c
+@@ -1197,15 +1197,16 @@ short rpn_calc(
+ }
+ }
+
++ /* when goodvals and badvals meet, they might have met on a
++ * NAN, which wouldn't decrease final_elements. so, check
++ * that now. */
++ if (isnan(*goodvals)) --final_elements;
++
+ stptr -= elements;
+ if (!final_elements) {
+ /* no non-NAN elements; push NAN */
+ rpnstack->s[++stptr] = DNAN;
+ } else {
+- /* when goodvals and badvals meet, they might have met on a
+- * NAN, which wouldn't decrease final_elements. so, check
+- * that now. */
+- if (isnan(*goodvals)) --final_elements;
+ /* and finally, take the median of the remaining non-NAN
+ * elements. */
+ qsort(element_ptr, final_elements, sizeof(double),