Repository navigation
fix: guard readFieldName lookahead against AIOOBE on trailing backslash - #22
Open
luckylucky0001 wants to merge 1 commit into
Open
luckylucky0001 wants to merge 1 commit into
luckylucky0001 wants to merge 1 commit into
Conversation
JSONReaderASCII.readFieldName() reads bytes[offset + 1] after seeing a backslash,
but the loop guard only covers bytes[offset]. When a field name ends in a backslash
(e.g. `{"\`, `{"a\`), offset + 1 == end, so the lookahead runs off the array and
throws ArrayIndexOutOfBoundsException instead of the expected JSONException.
Add an explicit check: if the backslash is the final byte, throw JSONException
(matching how malformed field names are already handled elsewhere).
Owner
Author
|
本机 medium 档代码评审结果 上游来源:alibaba#7833。样本:原版 PR。 结论分三种:通过;需关注(AI 意见和无法验证的内容,不阻止合并);阻断(只在执行证据证实本 PR 引入缺陷,或仓库自己的 CI 失败时)。单条意见:已确认=通过稳定复现、归因和证据准入的缺陷;疑似=尚未排除、证据仍不足;待确认=未复现、既有行为或未完成验证;团队强制规则=命中团队规则,需人工确认。
medium 失败计数分域:PR 侧 unknown 0;基线侧失败 0 项,其中 unknown 0 项。unknown 保持原分类,不构成准入证据。 请求模型: medium · 阻断:仓库 CI 失败:Test JDK 17 on ubuntu-24.04。 medium 结论
建议人工介入项不作为确认缺陷或自动修复的证据;尚未排除的疑似缺陷仍需核查。本结果只覆盖该提交、本次已执行测试与medium 档评审。 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes alibaba#7809
JSONReaderASCII.readFieldName()readsbytes[offset + 1]after seeing a backslash, but the loop guard only coversbytes[offset]. When a field name ends in a backslash,offset + 1 == end, so the lookahead runs off the array and throwsArrayIndexOutOfBoundsExceptioninstead ofJSONException.Add an explicit check: if the backslash is the final byte, throw
JSONException, matching how malformed field names are handled elsewhere.Evaluation replay of alibaba#7833 (alibaba#7833). This PR stays open unless a separately authorized merge workflow runs.