svn commit: r516110 - in head/databases/rrdtool: . files
Niclas Zeising
zeising at FreeBSD.org
Wed Oct 30 22:23:51 UTC 2019
Author: zeising
Date: Wed Oct 30 22:23:50 2019
New Revision: 516110
URL: https://svnweb.freebsd.org/changeset/ports/516110
Log:
databases/rrdtool: Fix segfault
Add upstream patch to databases/rrdtool to fix segfault when trying to
calculate median of all-NaN values
PR: 241477
Submitted by: amdmi3
MFH: 2019Q4
Added:
head/databases/rrdtool/files/patch-src_rrd__rpncalc.c (contents, props changed)
Modified:
head/databases/rrdtool/Makefile
Modified: head/databases/rrdtool/Makefile
==============================================================================
--- head/databases/rrdtool/Makefile Wed Oct 30 22:20:58 2019 (r516109)
+++ head/databases/rrdtool/Makefile Wed Oct 30 22:23:50 2019 (r516110)
@@ -3,6 +3,7 @@
PORTNAME= rrdtool
PORTVERSION= 1.7.2
+PORTREVISION= 1
CATEGORIES= databases graphics
MASTER_SITES= http://oss.oetiker.ch/rrdtool/pub/
Added: head/databases/rrdtool/files/patch-src_rrd__rpncalc.c
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ head/databases/rrdtool/files/patch-src_rrd__rpncalc.c Wed Oct 30 22:23:50 2019 (r516110)
@@ -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),
More information about the svn-ports-head
mailing list