[BUG] In Version 2.0.61 , has Error when data is so big ,but Version 2.0.60 is work ok
- Dominant language
- Java
- Stars
- 4.4k
- Forks
- 613
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 6
Description
### 问题描述
最新版本的 2.0.61 ,当用比较大的 text ,转换为 jsonobject 的时候,会报错:
java.lang.ArrayIndexOutOfBoundsException:arraycopy: last destination index 2544 out of bounds for char[512]
at java.base/java.lang.System.arraycopy(Native Method)
at com.alibaba.fastjson2.JSONReaderUTF16.readString(JSONReaderUTF16.java:3259)
at com.alibaba.fastjson2.JSONReader.readObject(JSONReader.java:3777)
at com.alibaba.fastjson2.JSONReader.read(JSONReader.java:3539)
at com.alibaba.fastjson2.JSON.parseObject(JSON.java:476)
at com.alibaba.fastjson2.JSONObject.parseObject(JSONObject.java:2212)
### 环境信息
- OS信息: win,linux,mac 均存在
- JDK信息: openjdk17
- 版本信息: 2.0.61
### 重现步骤
```java
public static void main(String[] args) {
String text = "这里放一个较大的json格式的字符串";
JSONObject jsonObject = JSONObject.parseObject(text);
System.out.println(jsonObject);
}
```
### 期待的正确结果
应该不报错,目前 2.0.60 版本是工作正常的
Contributor guide
Research direction
Reproduce the failure with a large JSON string using JSONObject.parseObject, then inspect JSONReaderUTF16.readString at line 3259 and the JSON.parseObject call path shown in the stack trace. Add coverage for input larger than the failing buffer and verify that parsing succeeds as it did in version 2.0.60.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 62/100