Repository navigation
Fix empty commented arrays in legacy Reader - #1719
Open
vaibhav0806 wants to merge 2 commits into
Open
vaibhav0806 wants to merge 2 commits into
vaibhav0806 wants to merge 2 commits into
Conversation
vaibhav0806
marked this pull request as ready for review
October 1, 2026 07:21
[Medium impact] The PR appears safe to merge; no new actionable issues were found.
|
Coverage Report for CI Build 40347616334Coverage increased (+0.2%) to 90.117%Details
Uncovered ChangesNo uncovered changes found. Coverage RegressionsNo coverage regressions found. Coverage Stats💛 - Coveralls |
This branch has not been deployed
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 #1238.
With comments enabled, legacy
Json::Readerrejects{"list":[ //\n]}and leaves a partial array containing null.CharReaderalready accepts the same document as an empty array.Consume allowed line/block comment tokens before the legacy reader's initial empty-array delimiter check, so it does not create element zero before discovering
]. Use the existing error recovery for malformed comments. Add four regression fixtures covering root/nested arrays, collection on/off, comments disallowed, unterminated comments, ordinary element/container comments, and offsets.Only
Reader::readArrayand its tests change. Public headers, declarations and class layout are unchanged. Modern parsing, numeric conversion, trailing-comma handling and comment storage are unchanged.Local validation on macOS arm64, Apple Clang 17, C++11, Debug, default configuration and static library:
git diff --checkand clang-format 17/20 checks pass; both formatters produce identical output for the changed files.The seven upstream workflows currently await maintainer approval on head
167330d624e203b35d4df35a33b935f04f810bea; no jobs or checks have run. Exact clang-format 18, Linux/Windows/shared-library builds and other language standards remain unverified. cppcheck was unavailable locally, so no static-analysis success is claimed.Prepared with AI assistance. The generated diff was independently checked and the local validation was run by an automated agent. No human review is claimed.