Skip to content

[BUG] In Version 2.0.61 , has Error when data is so big ,but Version 2.0.60 is work ok #4034

@gooking

Description

@gooking

问题描述

最新版本的 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

重现步骤

public static void main(String[] args) {
      String text = "这里放一个较大的json格式的字符串";
      JSONObject jsonObject = JSONObject.parseObject(text);
      System.out.println(jsonObject);
  }

期待的正确结果

应该不报错,目前 2.0.60 版本是工作正常的

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions