Skip to content
Snippets Groups Projects
Verified Commit 9923a8c1 authored by Diederik de Haas's avatar Diederik de Haas
Browse files

d/patches: Add "Fix unsigned integer overflow in rrdtool first" patch

parent f3ae95cd
No related branches found
No related tags found
No related merge requests found
......@@ -22,6 +22,7 @@ rrdtool (1.8.0-1) UNRELEASED; urgency=medium
- "acinclude.m4: Include <stdlib.h> when using exit"
- "Update Version and Copyright year in git files"
- "Fix BUILD_DATE in rrdtool help output"
- "Fix unsigned integer overflow in rrdtool first"
-- Jean-Michel Vourgère <nirgal@debian.org> Mon, 21 Mar 2022 10:55:32 +0100
......
From: =?UTF-8?q?Wolfgang=20St=C3=B6ggl?= <c72578@yahoo.de>
Date: Fri, 1 Apr 2022 19:14:49 +0200
Subject: Fix unsigned integer overflow in rrdtool first
Origin: https://github.com/oetiker/rrdtool-1.x/commit/b74a0d64e00770384d025e40becdb2ed83c04c0c
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 0e93397c..a696c5c3 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:
--
2.40.0
......@@ -4,3 +4,4 @@ translations
acinclude.m4-Include-stdlib.h-when-using-exit.patch
Update-Version-and-Copyright-year-in-git-files.patch
Fix-BUILD_DATE-in-rrdtool-help-output.patch
Fix-unsigned-integer-overflow-in-rrdtool-first.patch
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment