From d8ff04ede2a04cc0902ec41c5abf9b31eb7f55b2 Mon Sep 17 00:00:00 2001 From: Looly Date: Mon, 27 Jan 2025 09:29:48 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8DAbstractFilter=E6=B2=A1?= =?UTF-8?q?=E6=9C=89=E6=A3=80=E6=9F=A5=E5=8F=82=E6=95=B0=E9=95=BF=E5=BA=A6?= =?UTF-8?q?=E9=97=AE=E9=A2=98=EF=BC=88issue#3854@Github=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 3 ++- .../main/java/cn/hutool/bloomfilter/filter/AbstractFilter.java | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 15188cd66..d20bd0e61 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ # 🚀Changelog ------------------------------------------------------------------------------------------------------------- -# 5.8.36(2025-01-24) +# 5.8.36(2025-01-27) ### 🐣新特性 * 【crypto 】 增加BCUtil.decodeECPrivateKey方法(issue#3829@Github) @@ -15,6 +15,7 @@ * 【aop 】 修复ProxyUtil可能的空指针问题(issue#IBF20Z@Gitee) * 【core 】 修复XmlUtil转义调用方法错误问题,修复XmlEscape未转义单引号问题(pr#3837@Github) * 【core 】 修复FileUtil.isAbsolutePath没有判断smb路径问题(pr#1299@Gitee) +* 【core 】 修复AbstractFilter没有检查参数长度问题(issue#3854@Github) ------------------------------------------------------------------------------------------------------------- # 5.8.35(2024-12-25) diff --git a/hutool-bloomFilter/src/main/java/cn/hutool/bloomfilter/filter/AbstractFilter.java b/hutool-bloomFilter/src/main/java/cn/hutool/bloomfilter/filter/AbstractFilter.java index bc37e729d..327fad055 100755 --- a/hutool-bloomFilter/src/main/java/cn/hutool/bloomfilter/filter/AbstractFilter.java +++ b/hutool-bloomFilter/src/main/java/cn/hutool/bloomfilter/filter/AbstractFilter.java @@ -4,6 +4,7 @@ import cn.hutool.bloomfilter.BloomFilter; import cn.hutool.bloomfilter.bitMap.BitMap; import cn.hutool.bloomfilter.bitMap.IntMap; import cn.hutool.bloomfilter.bitMap.LongMap; +import cn.hutool.core.lang.Assert; /** * 抽象Bloom过滤器 @@ -46,7 +47,7 @@ public abstract class AbstractFilter implements BloomFilter { * @param machineNum 机器位数 */ public void init(long maxValue, int machineNum) { - this.size = maxValue; + this.size = Assert.checkBetween(maxValue, 1, Integer.MAX_VALUE); switch (machineNum) { case BitMap.MACHINE32: bm = new IntMap((int) (size / machineNum));