grafana/0009-Prometheus-Fix-integer-overflow-in-rate-interval-cal.patch
Andreas Gerstmayr 0313c1b6d5 update to upstream Grafana 9.0.9, fix CVE-2022-35957
Resolves: rhbz#2125530
2022-09-21 16:00:28 +02:00

21 lines
900 B
Diff

From 9c3f27a440c515c3b8949c981a58666c7de3c8bc Mon Sep 17 00:00:00 2001
From: Andreas Gerstmayr <agerstmayr@redhat.com>
Date: Tue, 5 Jul 2022 17:04:13 +0200
Subject: [PATCH] Prometheus: Fix integer overflow in rate interval calculation
on 32-bit architectures 2
diff --git a/pkg/tsdb/prometheus/models/query.go b/pkg/tsdb/prometheus/models/query.go
index bdd48d08ed..aa2b1f9945 100644
--- a/pkg/tsdb/prometheus/models/query.go
+++ b/pkg/tsdb/prometheus/models/query.go
@@ -181,7 +181,7 @@ func calculateRateInterval(interval time.Duration, scrapeInterval string, interv
return time.Duration(0)
}
- rateInterval := time.Duration(int(math.Max(float64(interval+scrapeIntervalDuration), float64(4)*float64(scrapeIntervalDuration))))
+ rateInterval := time.Duration(int64(math.Max(float64(interval+scrapeIntervalDuration), float64(4)*float64(scrapeIntervalDuration))))
return rateInterval
}