From 88c0f13fd94eaf08d707aefde3c3b1a233f39290 Mon Sep 17 00:00:00 2001 From: Andreas Gerstmayr 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/time_series_query.go b/pkg/tsdb/prometheus/time_series_query.go index d768738d8a..ee98264a31 100644 --- a/pkg/tsdb/prometheus/time_series_query.go +++ b/pkg/tsdb/prometheus/time_series_query.go @@ -285,7 +285,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 }