mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-08-07 15:47:01 +02:00
BUG/MINOR: regex: Properly handle PCRE2 lib compiled without JIT support
The PCRE2 JIT support is buggy. If HAProxy is compiled with USE_PCRE2_JIT option while the PCRE2 library is compiled without the JIT support, any matching will fail because pcre2_jit_compile() return value is not properly handled. We must fall back on pcre2_match() if PCRE2_ERROR_JIT_BADOPTION error is returned. This patch should fix the issue #1848. It must be backported as far as 2.4.
This commit is contained in:
parent
32872db605
commit
f348ecd67a
10
src/regex.c
10
src/regex.c
@ -372,12 +372,16 @@ struct my_regex *regex_comp(const char *str, int cs, int cap, char **err)
|
|||||||
* We end if it is an error not related to lack of JIT support
|
* We end if it is an error not related to lack of JIT support
|
||||||
* in a case of JIT support missing pcre2_jit_compile is "no-op"
|
* in a case of JIT support missing pcre2_jit_compile is "no-op"
|
||||||
*/
|
*/
|
||||||
if (jit < 0 && jit != PCRE2_ERROR_JIT_BADOPTION) {
|
if (!jit)
|
||||||
|
regex->mfn = &pcre2_jit_match;
|
||||||
|
else {
|
||||||
|
if (jit != PCRE2_ERROR_JIT_BADOPTION) {
|
||||||
pcre2_code_free(regex->reg);
|
pcre2_code_free(regex->reg);
|
||||||
memprintf(err, "regex '%s' jit compilation failed", str);
|
memprintf(err, "regex '%s' jit compilation failed", str);
|
||||||
goto out_fail_alloc;
|
goto out_fail_alloc;
|
||||||
} else {
|
}
|
||||||
regex->mfn = &pcre2_jit_match;
|
else
|
||||||
|
regex->mfn = &pcre2_match;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user