Skip to content

Commit

Permalink
[fix] 修复 fastjson2 在反序列化列表对象存在引用关系时,存在数据数组越界或者数据丢失的问题 (#2149)
Browse files Browse the repository at this point in the history
* [fix] 修复 fastjson2 在反序列化列表对象存在引用关系时,存在数据数组越界或者数据丢失的问题
  • Loading branch information
zhuangdeshuai authored Jan 3, 2024
1 parent ee93703 commit a32e68b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion core/src/main/java/com/alibaba/fastjson2/JSONReader.java
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,11 @@ public final void handleResolveTasks(Object root) {
if (index == list.size()) {
list.add(fieldValue);
} else {
list.set(index, fieldValue);
if (index < list.size() && list.get(index) == null) {
list.set(index, fieldValue);
} else {
list.add(index, fieldValue);
}
}
continue;
}
Expand Down

0 comments on commit a32e68b

Please sign in to comment.