grafana/0008-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
955 B
Diff

From 37aed65376760b8459f4588a15ba55fe43131a8b Mon Sep 17 00:00:00 2001
From: Andreas Gerstmayr <agerstmayr@redhat.com>
Date: Mon, 27 Jun 2022 17:12:27 +0200
Subject: [PATCH] Prometheus: Fix integer overflow in rate interval calculation
on 32-bit architectures
diff --git a/pkg/tsdb/prometheus/buffered/time_series_query.go b/pkg/tsdb/prometheus/buffered/time_series_query.go
index 40db2d9100..0af2d3ecab 100644
--- a/pkg/tsdb/prometheus/buffered/time_series_query.go
+++ b/pkg/tsdb/prometheus/buffered/time_series_query.go
@@ -326,7 +326,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
}