Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

parseArray(String text, Class<T> type)当解析的字符串最后多一个逗号会导致异常[BUG] #709

Closed
bobtang opened this issue Aug 25, 2022 · 3 comments
Labels
bug Something isn't working fixed
Milestone

Comments

@bobtang
Copy link

bobtang commented Aug 25, 2022

问题描述

JSONArray.parseArray当解析的字符串最后多一个逗号会导致数据一直插入0直到内存崩溃

环境信息

请填写以下信息:

  • OS信息: [e.g.:CentOS 8.4.2105 4Core 3.10GHz 16 GB]
  • JDK信息: [e.g.:Openjdk 1.8.0_312]
  • 版本信息:[e.g.:Fastjson2 2.0.12]

重现步骤

如何操作可以重现该问题:

  1. 使用 parseArray(String text, Class type)
  2. 输入[1,], Integer.class
  3. 出现 java.lang.OutOfMemoryError: Java heap space 错误
String str = "[1,]";
List<Integer> list = JSONArray.parseArray(str, Integer.class);

期待的正确结果

执行完上述代码得到list有1一个数值

@bobtang bobtang added the bug Something isn't working label Aug 25, 2022
@wenshao
Copy link
Member

wenshao commented Aug 26, 2022

https://oss.sonatype.org/content/repositories/snapshots/com/alibaba/fastjson2/fastjson2/2.0.13-SNAPSHOT/
问题已经修复,请用2.0.13-SNAPSHOT版本验证,2.0.13版本预计在9月12日前发布

@wenshao wenshao added this to the 2.0.13 milestone Aug 26, 2022
@wenshao wenshao added the fixed label Aug 26, 2022
@wenshao
Copy link
Member

wenshao commented Sep 10, 2022

https://github.com/alibaba/fastjson2/releases/tag/2.0.13
2.0.13版本已经发布,请用帮忙用新版本验证

@wenshao wenshao closed this as completed Sep 10, 2022
@zhrgithub
Copy link

zhrgithub commented Oct 11, 2022 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working fixed
Projects
None yet
Development

No branches or pull requests

3 participants