修复Ipv4Util.getEndIpLong 取反符号导致数据越界

This commit is contained in:
Looly 2023-08-21 11:53:29 +08:00
parent 80bdac99d9
commit 713832e5fe
2 changed files with 3 additions and 2 deletions

View File

@ -2,7 +2,7 @@
# 🚀Changelog
-------------------------------------------------------------------------------------------------------------
# 5.8.22(2023-08-16)
# 5.8.22(2023-08-21)
### 🐣新特性
* 【core 】 NumberUtil.nullToZero增加重载issue#I7PPD2@Gitee
@ -22,6 +22,7 @@
* 【core 】 去除默认的ACCEPT_LANGUAGEissue#3258@Github
* 【core 】 修复FieldsComparator比较结果不正确问题issue#3259@Github
* 【core 】 修复Db.findAll全局忽略大小写无效问题issue#I7T30Y@Gitee
* 【core 】 修复Ipv4Util.getEndIpLong 取反符号导致数据越界issue#I7U1OQ@Gitee
-------------------------------------------------------------------------------------------------------------
# 5.8.21(2023-07-29)

View File

@ -407,7 +407,7 @@ public class Ipv4Util {
*/
public static Long getEndIpLong(String ip, int maskBit) {
return getBeginIpLong(ip, maskBit)
+ ~ipv4ToLong(getMaskByMaskBit(maskBit));
+ (0xffffffffL & ~ipv4ToLong(getMaskByMaskBit(maskBit)));
}
/**