Skip to content

Avoid scanning a terminator after an incomplete datetime - #314

Merged
marzer merged 3 commits into
marzer:masterfrom
allenflux:allenflux/fix-incomplete-spaced-datetime-scan
Nov 1, 2026
Merged

marzer merged 3 commits into
marzer:masterfrom
allenflux:allenflux/fix-incomplete-spaced-datetime-scan

Conversation

@allenflux

Copy link
Copy Markdown
Contributor

What does this change do?

Parsing a = 2026-10-13 1\n reaches the value-trait scanner on a line terminator, violating its assertion. Treat an already-reached terminator like EOF so the existing date backtracking reports the normal parse error instead. This also works when exceptions are disabled.

Add one regression to the existing user-feedback test, whose helper exercises string and stream inputs, and regenerate toml.hpp.

Is it related to an exisiting bug report or feature request?

Fixes #313.

Validation

Apple Clang 21, macOS arm64, C++17, warnings treated as errors:

  • The added regression aborts on the original implementation. The standalone original reproducer aborts with exceptions enabled and disabled.
  • Complete C-locale suites pass: Debug and Release each have 54 cases / 46,804 assertions; exceptions-disabled Debug has 56 cases / 46,848 assertions. ODR executables also build and run.
  • The Debug suite passes with C and all eight corresponding macOS UTF-8 locales. The project's unchanged Linux .utf8 locale spellings fail at startup on this Mac on both original and fixed code.
  • ASan/UBSan pass for all 19 parsing/user-feedback cases / 41,982 assertions with exceptions disabled. A full sanitizer run stops in the unchanged arrays-equality test at tests/manipulating_arrays.cpp:235 with the same stack-use-after-scope on original and fixed code; no full-suite sanitizer pass is claimed.
  • The official single-header consistency check and git diff --check pass.

Pre-merge checklist

  • I've read CONTRIBUTING.md
  • My changes are based on the current origin/master head inspected during preparation
  • I've added a regression test
  • I've regenerated toml.hpp (how-to)
  • I've updated any affected documentation (no API or usage change)
  • I've rebuilt and run the tests with Clang 8 or higher (Apple Clang 21)
  • I've added my name to the README contributor list

Prepared and tested with OpenAI Codex assistance.

@allenflux
allenflux marked this pull request as ready for review October 14, 2026 05:14

@marzer marzer left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add an entry to the CHANGELOG, then I'm happy to merge this 👍🏼

@marzer
marzer force-pushed the allenflux/fix-incomplete-spaced-datetime-scan branch from fdc0c40 to c305959 Compare November 1, 2026 11:32
@marzer
marzer merged commit 8c6e5e2 into marzer:master Nov 1, 2026
14 checks passed
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.

Assertion failure when a date is followed by a space and a number (a = 2026-10-13 1)

2 participants