]> git.ipfire.org Git - thirdparty/haproxy.git/commit
BUG/MEDIUM: regex: allocate a large enough pcre2 match for all matches
authorWilly Tarreau <w@1wt.eu>
Sun, 24 May 2026 11:11:09 +0000 (13:11 +0200)
committerWilly Tarreau <w@1wt.eu>
Mon, 25 May 2026 08:16:06 +0000 (10:16 +0200)
commit608951844e496f595cb1c8f299506dc41908147f
tree911f499cf885f50701c879db5527c1824789c435
parentf9088a5d7500ebb39deff7c839817977c1b1d11c
BUG/MEDIUM: regex: allocate a large enough pcre2 match for all matches

In 3.3 with commit fda6dc959 ("MINOR: regex: use a thread-local match
pointer for pcre2") we got a thread-local match that saves us from having
to allocate a match array with each match. However something was clearly
overlooked or misunderstood in the pcre2 API because the local match
array was initialized via pcre2_match_data_create() for MAX_MATCH-1
entries instead of MAX_MATCH, despite the commit message mentioning
MAX_MATCH entries. It was possibly confused with an index. Due to this
there is a risk of crash when matching more than 9 groups in a regex.

This fix must be backported to 3.3.
src/regex.c