Skip to content

Commit bc50058

Browse files
committed
fix: add msc_fullinfo() to check JIT compilation
1 parent 1a2de10 commit bc50058

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

apache2/re_operators.c

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -725,6 +725,10 @@ static int msre_op_validateHash_param_init(msre_rule *rule, char **error_msg) {
725725
#ifdef WITH_PCRE_JIT
726726
#ifdef WITH_PCRE2
727727
rc = regex->jit_compile_rc;
728+
if (rc == 0) {
729+
msc_fullinfo(regex, PCRE2_INFO_JITSIZE, &jit);
730+
jit = (jit > 0) ? 1 : 0;
731+
}
728732
#else
729733
rc = msc_fullinfo(regex, PCRE_INFO_JIT, &jit);
730734
#endif
@@ -831,6 +835,10 @@ static int msre_op_validateHash_execute(modsec_rec *msr, msre_rule *rule, msre_v
831835
if (msr->txcfg->debuglog_level >= 4) {
832836
#ifdef WITH_PCRE2
833837
rc = regex->jit_compile_rc;
838+
if (rc == 0) {
839+
msc_fullinfo(regex, PCRE2_INFO_JITSIZE, &jit);
840+
jit = (jit > 0) ? 1 : 0;
841+
}
834842
#else
835843
rc = msc_fullinfo(regex, PCRE_INFO_JIT, &jit);
836844
#endif
@@ -1002,6 +1010,10 @@ static int msre_op_rx_param_init(msre_rule *rule, char **error_msg) {
10021010
#ifdef WITH_PCRE_JIT
10031011
#ifdef WITH_PCRE2
10041012
rc = regex->jit_compile_rc;
1013+
if (rc == 0) {
1014+
msc_fullinfo(regex, PCRE2_INFO_JITSIZE, &jit);
1015+
jit = (jit > 0) ? 1 : 0;
1016+
}
10051017
#else
10061018
rc = msc_fullinfo(regex, PCRE_INFO_JIT, &jit);
10071019
#endif
@@ -1100,6 +1112,10 @@ static int msre_op_rx_execute(modsec_rec *msr, msre_rule *rule, msre_var *var, c
11001112
if (msr->txcfg->debuglog_level >= 4) {
11011113
#ifdef WITH_PCRE2
11021114
rc = regex->jit_compile_rc;
1115+
if (rc == 0) {
1116+
msc_fullinfo(regex, PCRE2_INFO_JITSIZE, &jit);
1117+
jit = (jit > 0) ? 1 : 0;
1118+
}
11031119
#else
11041120
rc = msc_fullinfo(regex, PCRE_INFO_JIT, &jit);
11051121
#endif
@@ -2991,6 +3007,10 @@ static int msre_op_verifyCC_execute(modsec_rec *msr, msre_rule *rule, msre_var *
29913007
if (msr->txcfg->debuglog_level >= 4) {
29923008
#ifdef WITH_PCRE2
29933009
rc = regex->jit_compile_rc;
3010+
if (rc == 0) {
3011+
msc_fullinfo(regex, PCRE2_INFO_JITSIZE, &jit);
3012+
jit = (jit > 0) ? 1 : 0;
3013+
}
29943014
#else
29953015
rc = msc_fullinfo(regex, PCRE_INFO_JIT, &jit);
29963016
#endif
@@ -3330,6 +3350,10 @@ static int msre_op_verifyCPF_execute(modsec_rec *msr, msre_rule *rule, msre_var
33303350
if (msr->txcfg->debuglog_level >= 4) {
33313351
#ifdef WITH_PCRE2
33323352
rc = regex->jit_compile_rc;
3353+
if (rc == 0) {
3354+
msc_fullinfo(regex, PCRE2_INFO_JITSIZE, &jit);
3355+
jit = (jit > 0) ? 1 : 0;
3356+
}
33333357
#else
33343358
rc = msc_fullinfo(regex, PCRE_INFO_JIT, &jit);
33353359
#endif
@@ -3655,6 +3679,10 @@ static int msre_op_verifySSN_execute(modsec_rec *msr, msre_rule *rule, msre_var
36553679
if (msr->txcfg->debuglog_level >= 4) {
36563680
#ifdef WITH_PCRE2
36573681
rc = regex->jit_compile_rc;
3682+
if (rc == 0) {
3683+
msc_fullinfo(regex, PCRE2_INFO_JITSIZE, &jit);
3684+
jit = (jit > 0) ? 1 : 0;
3685+
}
36583686
#else
36593687
rc = msc_fullinfo(regex, PCRE_INFO_JIT, &jit);
36603688
#endif

0 commit comments

Comments
 (0)