This commit is contained in:
Looly 2023-04-01 01:13:12 +08:00
parent 2cadd59600
commit 74071035e1
4 changed files with 26 additions and 6 deletions

View File

@ -2,7 +2,7 @@
# 🚀Changelog
-------------------------------------------------------------------------------------------------------------
# 5.8.17.M1 (2023-03-31)
# 5.8.17.M1 (2023-04-01)
### 🐣新特性
* 【core 】 SerializeUtil.deserialize增加白名单类避免RCE vulnerabilityissue#3021@Github
@ -17,7 +17,6 @@
### 🐞Bug修复
* 【core 】 CollUtil.split优化切割列表参数判断避免OOMpr#3026@Github
* 【core 】 修复FileUtil.move传入相同目录或子目录丢失源目录的问题pr#3032@Github
* 【core 】 修复MapUtil.computeIfAbsent可能存在的并发问题issue#I6RVMY@Gitee
-------------------------------------------------------------------------------------------------------------
# 5.8.16 (2023-03-26)

View File

@ -221,7 +221,9 @@ public class ZipReader implements Closeable {
try {
ZipEntry zipEntry;
while (null != (zipEntry = in.getNextEntry())) {
consumer.accept(checkZipBomb(zipEntry));
consumer.accept(zipEntry);
// 检查ZipBomb放在读取内容之后以便entry中的信息正常读取
checkZipBomb(zipEntry);
}
} catch (IOException e) {
throw new IORuntimeException(e);

View File

@ -1483,8 +1483,12 @@ public class MapUtil {
if (JdkUtil.IS_JDK8) {
V value = map.get(key);
if (null == value) {
//map.putIfAbsent(key, mappingFunction.apply(key));
value = map.computeIfAbsent(key, mappingFunction);
map.putIfAbsent(key, mappingFunction.apply(key));
value = map.get(key);
// 判空后调用依旧无法解决死循环问题
// Issue2349Test
//value = map.computeIfAbsent(key, mappingFunction);
}
return value;
} else {

View File

@ -1,5 +1,7 @@
package cn.hutool.core.map;
import cn.hutool.core.util.JdkUtil;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.function.Function;
@ -69,6 +71,19 @@ public class SafeConcurrentHashMap<K, V> extends ConcurrentHashMap<K, V> {
@Override
public V computeIfAbsent(K key, Function<? super K, ? extends V> mappingFunction) {
return MapUtil.computeIfAbsent(this, key, mappingFunction);
if (JdkUtil.IS_JDK8) {
V value = get(key);
if (null == value) {
putIfAbsent(key, mappingFunction.apply(key));
value = get(key);
// 判空后调用依旧无法解决死循环问题
// Issue2349Test
//value = map.computeIfAbsent(key, mappingFunction);
}
return value;
} else {
return super.computeIfAbsent(key, mappingFunction);
}
}
}