Skip to content

Fix leak & stale PCRE2_MD_COPIED_SUBJECT if pcre2_jit_match used with existing match context - #937

Merged
NWilson merged 2 commits into
mainfrom
user/niwilson/jitfast-copysubject
Aug 8, 2026
Merged

Fix leak & stale PCRE2_MD_COPIED_SUBJECT if pcre2_jit_match used with existing match context#937
NWilson merged 2 commits into
mainfrom
user/niwilson/jitfast-copysubject

Conversation

@NWilson

@NWilson NWilson commented Aug 8, 2026

Copy link
Copy Markdown
Member

The problem is not that pcre2_jit_match() needs to add support for PCRE2_COPY_MATCHED_SUBJECT. Instead, if the passed-in context somehow contains a previously-copied subject (by non-JIT matcher using a global or cached subject) then it will be leaked, and worse, incorrectly free'd later.

Fixes #920

@zherczeg zherczeg left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM

@NWilson
NWilson merged commit 1dcd0cf into main Aug 8, 2026
38 checks passed
@NWilson
NWilson deleted the user/niwilson/jitfast-copysubject branch August 8, 2026 18:17
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.

pcre2_jit_match() does not release a PCRE2_COPY_MATCHED_SUBJECT copy on reuse, causing a leak and an invalid free

2 participants