From ae83ea5cd361ef5a3f798d064a993b68cb29c2fc Mon Sep 17 00:00:00 2001 From: Matt Clarke <matt.clarke@ess.eu> Date: Fri, 24 Jan 2025 06:09:34 +0000 Subject: [PATCH] remove possibility of integer overflow in partitionfilter --- src/Stream/PartitionFilter.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Stream/PartitionFilter.cpp b/src/Stream/PartitionFilter.cpp index d5d6e1c68..e12ec2784 100644 --- a/src/Stream/PartitionFilter.cpp +++ b/src/Stream/PartitionFilter.cpp @@ -20,10 +20,11 @@ PartitionFilter::PartitionFilter(time_point stop_time, std::unique_ptr<Clock> clock) : _stop_time(stop_time), _stop_leeway(stop_time_leeway), _time_limit(time_limit), _clock(std::move(clock)) { - // Deal with potential overflow problem + // Deal with potential overflow problems if (time_point::max() - _stop_time <= stop_time_leeway) { _stop_time -= stop_time_leeway; } + _status_occurrence_time = time_point::max() - _time_limit; } bool PartitionFilter::hasExceededTimeLimit() const { -- GitLab