From 194d4be01dfe65559fd95b7ca4896eb6bda0c531 Mon Sep 17 00:00:00 2001 From: Long Dai Date: Wed, 28 Jul 2021 13:38:00 +0800 Subject: [PATCH] Fix LeapArray integer overflow problem on 32-bit platform (#422) Signed-off-by: Long Dai --- core/stat/base/leap_array.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/core/stat/base/leap_array.go b/core/stat/base/leap_array.go index d8f62be1..cc581a66 100644 --- a/core/stat/base/leap_array.go +++ b/core/stat/base/leap_array.go @@ -70,8 +70,7 @@ func NewAtomicBucketWrapArrayWithTime(len int, bucketLengthInMs uint32, now uint data: make([]*BucketWrap, len), } - timeId := now / uint64(bucketLengthInMs) - idx := int(timeId) % len + idx := int((now / uint64(bucketLengthInMs)) % uint64(len)) startTime := calculateStartTime(now, bucketLengthInMs) for i := idx; i <= len-1; i++ {