]> git.ipfire.org Git - thirdparty/apache/httpd.git/commit
Rewrite ap_regexec() without a thread-local storage context for allocations.
authorIvan Zhakov <ivan@apache.org>
Fri, 8 Jul 2022 15:07:00 +0000 (15:07 +0000)
committerIvan Zhakov <ivan@apache.org>
Fri, 8 Jul 2022 15:07:00 +0000 (15:07 +0000)
commitb93394ec6927d19d6de36e0618b1d52612aa6136
treed8a9e1f9bc512264113b182cf6b76fc3d666ce7e
parentc50caf2381c9b55056fb7fee1230a9ab5662b994
Rewrite ap_regexec() without a thread-local storage context for allocations.

Provide custom malloc() and free() implementations that use a stack buffer
for first N bytes and then fall back to an ordinary malloc/free().

The key properties of this approach are:

1) Allocations with PCRE2 happen the same way as they were happening
with PCRE1 in httpd 2.4.52 and earlier.

2) There are no malloc()/free() calls for typical cases where the
match data can be kept on stack.

3) The patch avoids a malloc() for the match_data structure itself,
because the match data is allocated with the provided custom malloc()
function.

4) Using custom allocation functions should ensure that PCRE is not
going to use malloc() for any auxiliary allocations, if they are
necessary.

5) There is no per-thread state.

References:
1) https://lists.apache.org/thread/l6m7dqjkk0yy3tooyd2so0rb20jmtpwd
2) https://lists.apache.org/thread/5k9y264whn4f1ll35tvl2164dz0wphvy

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1902572 13f79535-47bb-0310-9956-ffa450edef68
server/util_pcre.c