diff
+ #include <limits.h>
  // ... (at the beginning of the function)
+ if (__builtin_saddll_overflow(bucketSize, bucketSize, &result) || result > capacity) {
+     return RedisModule_ReplyWithError(ctx, "BUCKETSIZE is too large or would cause overflow");
+ }
- if (bucketSize * 2 > capacity) {
