Skip to content

Fix stream_parser::finish after a suspended comment - #1225

Open
mzfr wants to merge 1 commit into
boostorg:developfrom
mzfr:fix/comment-boundary-finish
Open

mzfr wants to merge 1 commit into
boostorg:developfrom
mzfr:fix/comment-boundary-finish

Conversation

@mzfr

@mzfr mzfr commented Nov 18, 2026

Copy link
Copy Markdown

When a line comment ends exactly at the end of an input buffer, the parser enters state::val3 to wait for the value following the comment. If finish() is called next, the final input range is empty, but the val3 resume path calls parse_value unconditionally. This dereferences the empty input pointer.

Handle an empty input range in val3 the same way as the existing whitespace-resume path: suspend while more input is possible, or let finalization report error::incomplete.

Add a stream_parser regression test covering a line comment whose newline is the final byte before finish().

Tests

  • b2 -q libs/json/test//stream_parser
  • b2 -q libs/json/test//basic_parser
  • b2 -q libs/json/test (51 test executables passed)
  • stream_parser test executable built and run with GCC 13.3.0 AddressSanitizer
  • stream_parser test executable built and run with GCC 13.3.0 UndefinedBehaviorSanitizer

@cppalliance-bot

Copy link
Copy Markdown

An automated preview of the documentation is available at https://1225.json.prtest2.cppalliance.org/libs/json/doc/html/index.html

If more commits are pushed to the pull request, the docs will rebuild at the same URL.

2026-11-18 05:55:57 UTC

@cppalliance-bot

Copy link
Copy Markdown

GCOVR code coverage report https://1225.json.prtest2.cppalliance.org/gcovr/index.html
LCOV code coverage report https://1225.json.prtest2.cppalliance.org/genhtml/index.html
Coverage Diff Report https://1225.json.prtest2.cppalliance.org/diff-report/index.html

Build time: 2026-11-18 06:24:02 UTC

@cppalliance-bot

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants