Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 31 Oct 2019 19:00:04 +0000 (UTC)
From:      Niclas Zeising <zeising@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-branches@freebsd.org
Subject:   svn commit: r516190 - in branches/2019Q4/databases/rrdtool: . files
Message-ID:  <201910311900.x9VJ04Ec072536@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: zeising
Date: Thu Oct 31 19:00:04 2019
New Revision: 516190
URL: https://svnweb.freebsd.org/changeset/ports/516190

Log:
  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)

Added:
  branches/2019Q4/databases/rrdtool/files/patch-src_rrd__rpncalc.c
     - copied unchanged from r516110, head/databases/rrdtool/files/patch-src_rrd__rpncalc.c
Modified:
  branches/2019Q4/databases/rrdtool/Makefile
Directory Properties:
  branches/2019Q4/   (props changed)

Modified: branches/2019Q4/databases/rrdtool/Makefile
==============================================================================
--- branches/2019Q4/databases/rrdtool/Makefile	Thu Oct 31 18:59:02 2019	(r516189)
+++ branches/2019Q4/databases/rrdtool/Makefile	Thu Oct 31 19:00:04 2019	(r516190)
@@ -3,6 +3,7 @@
 
 PORTNAME=	rrdtool
 PORTVERSION=	1.7.2
+PORTREVISION=	1
 CATEGORIES=	databases graphics
 MASTER_SITES=	http://oss.oetiker.ch/rrdtool/pub/
 

Copied: branches/2019Q4/databases/rrdtool/files/patch-src_rrd__rpncalc.c (from r516110, head/databases/rrdtool/files/patch-src_rrd__rpncalc.c)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ branches/2019Q4/databases/rrdtool/files/patch-src_rrd__rpncalc.c	Thu Oct 31 19:00:04 2019	(r516190, copy of r516110, head/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),



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201910311900.x9VJ04Ec072536>