Skip to content

Read the body source after destination allocation - #231

Merged
rafaelfranca merged 1 commit into
masterfrom
ci-fixes/parser-gc
Nov 18, 2026
Merged

rafaelfranca merged 1 commit into
masterfrom
ci-fixes/parser-gc

Conversation

@rafaelfranca

@rafaelfranca rafaelfranca commented Nov 18, 2026 •

Copy link
Copy Markdown
Member

Problem

HttpParser#filter_body reads the source pointer before it converts or resizes the destination.
Ruby code or allocation can change the source before the parser uses that pointer.
The old pointer can then refer to invalid data.

Solution

Read the source length after destination conversion.
Read the source pointer after the destination changes.
Add a regression test for chunked and fixed-length bodies.

Verification

  • The destination conversion and GC compaction tests passed on x86-64 Linux with Ruby 3.2.3.
  • After the branch merged with current master, Ragel output matched the checked-in C on x86-64.
  • CI also reports a separate worker timeout test failure. PR Preserve worker spawn deadlines in the mold #233 addresses that failure.

filter_body reads the source pointer before it converts or resizes the destination. Ruby code or allocation can change the source before the parser uses that pointer.

Read the source length after destination conversion. Read the source pointer after destination allocation. Add tests for chunked and fixed-length bodies.
@rafaelfranca
rafaelfranca marked this pull request as draft November 18, 2026 22:46
@rafaelfranca
rafaelfranca marked this pull request as ready for review November 18, 2026 23:12
@rafaelfranca
rafaelfranca merged commit 3998c75 into master Nov 18, 2026
11 of 13 checks passed
@rafaelfranca
rafaelfranca deleted the ci-fixes/parser-gc branch November 18, 2026 23:19
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.

1 participant