alibaba / alibaba/fastjson2

JSONWriterUTF8 当长度超过 8192 时,直接报 ArrayIndexOutOfBoundsException ?

Open
#1,720 5 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Java
Stars
4.4k
Forks
613
Avg merge
1d 22h
Merged PRs (30d)
6

Description

### 问题描述
JSONWriterUTF8 当长度超过 8192 时,直接报 ArrayIndexOutOfBoundsException

### 问题代码
https://github.com/alibaba/fastjson2/blob/09c3e0449f75abb135290fa054497c03237496f3/core/src/main/java/com/alibaba/fastjson2/JSONWriterUTF8.java#L50

### 数据
数据字符中可能存在乱码的情况

Contributor guide

Open the contributing guide

Research direction

Start with core/src/main/java/com/alibaba/fastjson2/JSONWriterUTF8.java around line 50 and reproduce the failure using input longer than 8192 characters, including the reported malformed-character case. Trace the buffer access that leads to ArrayIndexOutOfBoundsException; done means the same inputs no longer fail and the behavior is covered by a regression test.

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
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.