Skip to content

fix: guard buffer trimming against capture underflow (#432) - #433

Merged
mysticmind merged 2 commits into
masterfrom
fix/432-empty-blockquote-capture-underflow
Jul 28, 2026
Merged

fix: guard buffer trimming against capture underflow (#432)#433
mysticmind merged 2 commits into
masterfrom
fix/432-empty-blockquote-capture-underflow

Conversation

@mysticmind

@mysticmind mysticmind commented Jul 28, 2026

Copy link
Copy Markdown
Owner

An empty block whose render trimmed trailing whitespace could delete text written before the enclosing Capture() started, making the captured region length negative and throwing ArgumentOutOfRangeException. Adjacent empty blockquotes, an empty blockquote between paragraphs, and empty-paragraph list items all hit this.

TrimTrailingSpaces now stops at the innermost active capture's start offset.

Fixes #432

An empty block whose render trimmed trailing whitespace could delete text
written before the enclosing Capture() started, making the captured region
length negative and throwing ArgumentOutOfRangeException. Adjacent empty
blockquotes, an empty blockquote between paragraphs, and empty-paragraph
list items all hit this.

TrimTrailingSpaces now stops at the innermost active capture's start offset.
The converter emits Environment.NewLine, so inline "expected" strings in
cases.json (authored with \n) failed on Windows. File-based expectations
already get platform endings from the checkout.
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.

Argument Out of Range Exception

1 participant