Skip to content

Comments

Fix/multiple documents#1403

Merged
jbeder merged 2 commits intojbeder:masterfrom
SGSSGene:fix/multiple_documents
Feb 17, 2026
Merged

Fix/multiple documents#1403
jbeder merged 2 commits intojbeder:masterfrom
SGSSGene:fix/multiple_documents

Conversation

@SGSSGene
Copy link
Contributor

Fixes the parsing of empty document in LoadAll function as described in PR #1319.

Two commits:

  1. demonstration of bug as described in Issue Can't parse streams containing empty documents in 0.9.0 #1402 . (and some minor naming cleanup)
  2. replaces fixes from PR fix(src): avoid possible infinite loop in LoadAll(). #1319 with a different mechanism.

Open question: Is checking for the reported position in a token a valid strategy?
Also the fixes of PR #1319 seem more of precaution are difficult to test. Simply reverting the fixes from PR #1319 would also not fail any unit tests.

Previously, no parsing progress (detecting infinite loops) was detected by an empty Node.
This falsely triggers an abort, if an empty YAML document is being parsed.

Instead, we detect if progress in the parsing stream is made, by
comparing token positions. As long as new tokens are being
parsed (detected by position change), we assume we are not in an
infinite loop.
@jbeder
Copy link
Owner

jbeder commented Feb 17, 2026

This sounds good, and yes, if we can't write a test, I think it's not worth maintaining a fix.

@jbeder jbeder merged commit f25f110 into jbeder:master Feb 17, 2026
31 checks passed
@SGSSGene SGSSGene deleted the fix/multiple_documents branch February 17, 2026 16:31
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