summaryrefslogtreecommitdiff
path: root/user
diff options
context:
space:
mode:
Diffstat (limited to 'user')
-rw-r--r--user/rrdtool/APKBUILD8
-rw-r--r--user/rrdtool/signedness.patch32
-rw-r--r--user/rrdtool/time64.patch51
3 files changed, 89 insertions, 2 deletions
diff --git a/user/rrdtool/APKBUILD b/user/rrdtool/APKBUILD
index d93cc19b7..2800b01b8 100644
--- a/user/rrdtool/APKBUILD
+++ b/user/rrdtool/APKBUILD
@@ -2,7 +2,7 @@
# Maintainer: Zach van Rijn <me@zv.io>
pkgname=rrdtool
pkgver=1.8.0
-pkgrel=0
+pkgrel=1
pkgdesc="Data logging and graphing application"
url="https://oss.oetiker.ch/rrdtool/"
arch="all"
@@ -15,6 +15,8 @@ subpackages="$pkgname-dev $pkgname-doc $pkgname-lang perl-rrd:perl_rrd
$pkgname-cached $pkgname-cgi $pkgname-utils librrd:libs"
source="https://github.com/oetiker/$pkgname-${pkgver%%.*}.x/releases/download/v$pkgver/$pkgname-$pkgver.tar.gz
rrdcached.initd
+ signedness.patch
+ time64.patch
"
build() {
@@ -84,4 +86,6 @@ utils() {
}
sha512sums="8ae6f94d119e8d0e1ba7f2d0738f1ba008a4880d1022f1c0c5436f662d961fceec5c42e01c241493ece3d6f55c60fd7d1d264f93e678f3cf1251201dcde027c1 rrdtool-1.8.0.tar.gz
-c0c27b2c2dfa8e7ec1cb1160d2bda8d7996bbea67f4ce7779da029f583c35e5e415cf46e2a1e5cb8ed2e63d2c58a68fd7471ee6bd820db4c0f4eeeb5c252f8a3 rrdcached.initd"
+c0c27b2c2dfa8e7ec1cb1160d2bda8d7996bbea67f4ce7779da029f583c35e5e415cf46e2a1e5cb8ed2e63d2c58a68fd7471ee6bd820db4c0f4eeeb5c252f8a3 rrdcached.initd
+da1218051c10c86bf19a1e2435f69dc072f231d22513bc474491bd7901427921be5ba1ff889166e9f9b3a95473055d64dfbc53d477da8b6446de2d5901ff78e6 signedness.patch
+aa119ea9a9b819b6d51b3a4351f26a34f0d4fdfeb28ee8f1b20a16ca8b9b1f6a6b85012fc53e40cc6ddee4dc0006b095476363f54e8c856b39da2ed7f4a0b8d9 time64.patch"
diff --git a/user/rrdtool/signedness.patch b/user/rrdtool/signedness.patch
new file mode 100644
index 000000000..ad3451d9f
--- /dev/null
+++ b/user/rrdtool/signedness.patch
@@ -0,0 +1,32 @@
+From b74a0d64e00770384d025e40becdb2ed83c04c0c Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Wolfgang=20St=C3=B6ggl?= <c72578@yahoo.de>
+Date: Fri, 1 Apr 2022 19:14:49 +0200
+Subject: [PATCH] Fix unsigned integer overflow in rrdtool first
+
+This fixes a signed/unsigned conversion bug in the calculation of
+"then". Background info:
+pdp_cnt and pdp_step are both unsigned long, whereas timer is signed.
+When multiplying signed and unsigned integers (same size), a signed is
+implicitly typecast to unsigned.
+
+- A similar fix has already been applied to rrd_dump.c
+ in commit e193975
+- Resolves #1140
+---
+ src/rrd_first.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/src/rrd_first.c b/src/rrd_first.c
+index 0e93397c3..a696c5c38 100644
+--- a/src/rrd_first.c
++++ b/src/rrd_first.c
+@@ -113,7 +113,8 @@ time_t rrd_first_r(
+ then = (rrd.live_head->last_up -
+ rrd.live_head->last_up %
+ (rrd.rra_def[rraindex].pdp_cnt * rrd.stat_head->pdp_step)) +
+- (timer * rrd.rra_def[rraindex].pdp_cnt * rrd.stat_head->pdp_step);
++ (timer * (long) rrd.rra_def[rraindex].pdp_cnt *
++ (long) rrd.stat_head->pdp_step);
+ err_close:
+ rrd_close(rrd_file);
+ err_free:
diff --git a/user/rrdtool/time64.patch b/user/rrdtool/time64.patch
new file mode 100644
index 000000000..5f5eea43e
--- /dev/null
+++ b/user/rrdtool/time64.patch
@@ -0,0 +1,51 @@
+--- rrdtool-1.8.0/src/rrd_graph_helper.c.old 2022-03-14 14:30:12.000000000 +0000
++++ rrdtool-1.8.0/src/rrd_graph_helper.c 2022-12-10 23:14:10.132482183 +0000
+@@ -1901,7 +1901,7 @@
+ dprintf("SHIFTBY : %s (%i)\n", im->gdes[gdp->shidx].vname,
+ gdp->shidx);
+ } else {
+-#if defined _WIN32 && SIZEOF_TIME_T == 8 /* in case of __MINGW64__, _WIN64 and _MSC_VER >= 1400 (ifndef _USE_32BIT_TIME_T) */
++#if SIZEOF_TIME_T == 8 /* in case of __MINGW64__, _WIN64 and _MSC_VER >= 1400 (ifndef _USE_32BIT_TIME_T) */
+ dprintf("SHIFTBY : %lli\n", gdp->shval); /* argument 3 has type 'time_t {aka long long int}' */
+ #else
+ dprintf("SHIFTBY : %li\n", gdp->shval);
+--- rrdtool-1.8.0/src/rrd_lastupdate.c.old 2022-03-14 14:30:12.000000000 +0000
++++ rrdtool-1.8.0/src/rrd_lastupdate.c 2022-12-10 23:14:48.138375888 +0000
+@@ -77,7 +77,7 @@
+ printf(" %s", ds_names[i]);
+ printf ("\n\n");
+
+-#if defined _WIN32 && SIZEOF_TIME_T == 8 /* in case of __MINGW64__, _WIN64 and _MSC_VER >= 1400 (ifndef _USE_32BIT_TIME_T) */
++#if SIZEOF_TIME_T == 8 /* in case of __MINGW64__, _WIN64 and _MSC_VER >= 1400 (ifndef _USE_32BIT_TIME_T) */
+ printf ("%10llu:", last_update); /* argument 2 has type 'time_t {aka long long int} */
+ #else
+ printf ("%10lu:", last_update);
+--- rrdtool-1.8.0/src/rrd_tool.c.old 2022-03-14 14:30:12.000000000 +0000
++++ rrdtool-1.8.0/src/rrd_tool.c 2022-12-10 23:14:38.579408674 +0000
+@@ -723,7 +723,7 @@
+ else if (strcmp("resize", argv[1]) == 0)
+ rrd_resize(argc - 1, &argv[1]);
+ else if (strcmp("last", argv[1]) == 0)
+-#if defined _WIN32 && SIZEOF_TIME_T == 8 /* in case of __MINGW64__, _WIN64 and _MSC_VER >= 1400 (ifndef _USE_32BIT_TIME_T) */
++#if SIZEOF_TIME_T == 8 /* in case of __MINGW64__, _WIN64 and _MSC_VER >= 1400 (ifndef _USE_32BIT_TIME_T) */
+ printf("%lld\n", rrd_last(argc - 1, &argv[1]));
+ #else
+ printf("%ld\n", rrd_last(argc - 1, &argv[1]));
+@@ -731,7 +731,7 @@
+ else if (strcmp("lastupdate", argv[1]) == 0) {
+ rrd_lastupdate(argc - 1, &argv[1]);
+ } else if (strcmp("first", argv[1]) == 0)
+-#if defined _WIN32 && SIZEOF_TIME_T == 8 /* in case of __MINGW64__, _WIN64 and _MSC_VER >= 1400 (ifndef _USE_32BIT_TIME_T) */
++#if SIZEOF_TIME_T == 8 /* in case of __MINGW64__, _WIN64 and _MSC_VER >= 1400 (ifndef _USE_32BIT_TIME_T) */
+ printf("%lld\n", rrd_first(argc - 1, &argv[1]));
+ #else
+ printf("%ld\n", rrd_first(argc - 1, &argv[1]));
+@@ -753,7 +753,7 @@
+ printf("%20s", ds_namv[i]);
+ printf("\n\n");
+ for (ti = start + step; ti <= end; ti += step) {
+-#if defined _WIN32 && SIZEOF_TIME_T == 8 /* in case of __MINGW64__, _WIN64 and _MSC_VER >= 1400 (ifndef _USE_32BIT_TIME_T) */
++#if SIZEOF_TIME_T == 8 /* in case of __MINGW64__, _WIN64 and _MSC_VER >= 1400 (ifndef _USE_32BIT_TIME_T) */
+ printf("%10llu:", ti);
+ #else
+ printf("%10lu:", ti);