MFH: r516110
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 Approved by: ports-secteam (joenum)
This commit is contained in:
parent
c8f1505e5e
commit
976f4ae470
Notes:
svn2git
2021-03-31 03:12:20 +00:00
svn path=/branches/2019Q4/; revision=516190
|
@ -3,6 +3,7 @@
|
|||
|
||||
PORTNAME= rrdtool
|
||||
PORTVERSION= 1.7.2
|
||||
PORTREVISION= 1
|
||||
CATEGORIES= databases graphics
|
||||
MASTER_SITES= http://oss.oetiker.ch/rrdtool/pub/
|
||||
|
||||
|
|
29
databases/rrdtool/files/patch-src_rrd__rpncalc.c
Normal file
29
databases/rrdtool/files/patch-src_rrd__rpncalc.c
Normal file
|
@ -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),
|
Loading…
Reference in New Issue
Block a user