|
37 | 37 |
|
38 | 38 | #include "libinjection/libinjection.h"
|
39 | 39 |
|
| 40 | +#ifdef WITH_PCRE_STUDY |
| 41 | +#ifdef WITH_PCRE_JIT |
| 42 | +#ifdef WITH_PCRE2 |
| 43 | +/** |
| 44 | + * @brief Set the JIT compile return code and JIT compile status. |
| 45 | + * \param regex regex structure |
| 46 | + * \param rc return code of the JIT compile |
| 47 | + * \param jit JIT compile status |
| 48 | + * \return void |
| 49 | + */ |
| 50 | +static void msc_op_set_jitrc(msc_regex_t *regex, int *rc, int *jit) { |
| 51 | + *rc = regex->jit_compile_rc; |
| 52 | + if (*rc == 0) { |
| 53 | + msc_fullinfo(regex, PCRE2_INFO_JITSIZE, jit); |
| 54 | + *jit = (*jit > 0) ? 1 : 0; |
| 55 | + } |
| 56 | + return; |
| 57 | +} |
| 58 | +#endif |
| 59 | +#endif |
| 60 | +#endif |
40 | 61 |
|
41 | 62 | /**
|
42 | 63 | *
|
@@ -724,7 +745,7 @@ static int msre_op_validateHash_param_init(msre_rule *rule, char **error_msg) {
|
724 | 745 | #ifdef WITH_PCRE_STUDY
|
725 | 746 | #ifdef WITH_PCRE_JIT
|
726 | 747 | #ifdef WITH_PCRE2
|
727 |
| - rc = regex->jit_compile_rc; |
| 748 | + msc_op_set_jitrc(regex, &rc, &jit); |
728 | 749 | #else
|
729 | 750 | rc = msc_fullinfo(regex, PCRE_INFO_JIT, &jit);
|
730 | 751 | #endif
|
@@ -830,7 +851,7 @@ static int msre_op_validateHash_execute(modsec_rec *msr, msre_rule *rule, msre_v
|
830 | 851 | #ifdef WITH_PCRE_JIT
|
831 | 852 | if (msr->txcfg->debuglog_level >= 4) {
|
832 | 853 | #ifdef WITH_PCRE2
|
833 |
| - rc = regex->jit_compile_rc; |
| 854 | + msc_op_set_jitrc(regex, &rc, &jit); |
834 | 855 | #else
|
835 | 856 | rc = msc_fullinfo(regex, PCRE_INFO_JIT, &jit);
|
836 | 857 | #endif
|
@@ -1001,7 +1022,7 @@ static int msre_op_rx_param_init(msre_rule *rule, char **error_msg) {
|
1001 | 1022 | #ifdef WITH_PCRE_STUDY
|
1002 | 1023 | #ifdef WITH_PCRE_JIT
|
1003 | 1024 | #ifdef WITH_PCRE2
|
1004 |
| - rc = regex->jit_compile_rc; |
| 1025 | + msc_op_set_jitrc(regex, &rc, &jit); |
1005 | 1026 | #else
|
1006 | 1027 | rc = msc_fullinfo(regex, PCRE_INFO_JIT, &jit);
|
1007 | 1028 | #endif
|
@@ -1099,7 +1120,7 @@ static int msre_op_rx_execute(modsec_rec *msr, msre_rule *rule, msre_var *var, c
|
1099 | 1120 | #ifdef WITH_PCRE_JIT
|
1100 | 1121 | if (msr->txcfg->debuglog_level >= 4) {
|
1101 | 1122 | #ifdef WITH_PCRE2
|
1102 |
| - rc = regex->jit_compile_rc; |
| 1123 | + msc_op_set_jitrc(regex, &rc, &jit); |
1103 | 1124 | #else
|
1104 | 1125 | rc = msc_fullinfo(regex, PCRE_INFO_JIT, &jit);
|
1105 | 1126 | #endif
|
@@ -2990,7 +3011,7 @@ static int msre_op_verifyCC_execute(modsec_rec *msr, msre_rule *rule, msre_var *
|
2990 | 3011 | #ifdef WITH_PCRE_JIT
|
2991 | 3012 | if (msr->txcfg->debuglog_level >= 4) {
|
2992 | 3013 | #ifdef WITH_PCRE2
|
2993 |
| - rc = regex->jit_compile_rc; |
| 3014 | + msc_op_set_jitrc(regex, &rc, &jit); |
2994 | 3015 | #else
|
2995 | 3016 | rc = msc_fullinfo(regex, PCRE_INFO_JIT, &jit);
|
2996 | 3017 | #endif
|
@@ -3329,7 +3350,7 @@ static int msre_op_verifyCPF_execute(modsec_rec *msr, msre_rule *rule, msre_var
|
3329 | 3350 | #ifdef WITH_PCRE_JIT
|
3330 | 3351 | if (msr->txcfg->debuglog_level >= 4) {
|
3331 | 3352 | #ifdef WITH_PCRE2
|
3332 |
| - rc = regex->jit_compile_rc; |
| 3353 | + msc_op_set_jitrc(regex, &rc, &jit); |
3333 | 3354 | #else
|
3334 | 3355 | rc = msc_fullinfo(regex, PCRE_INFO_JIT, &jit);
|
3335 | 3356 | #endif
|
@@ -3654,7 +3675,7 @@ static int msre_op_verifySSN_execute(modsec_rec *msr, msre_rule *rule, msre_var
|
3654 | 3675 | #ifdef WITH_PCRE_JIT
|
3655 | 3676 | if (msr->txcfg->debuglog_level >= 4) {
|
3656 | 3677 | #ifdef WITH_PCRE2
|
3657 |
| - rc = regex->jit_compile_rc; |
| 3678 | + msc_op_set_jitrc(regex, &rc, &jit); |
3658 | 3679 | #else
|
3659 | 3680 | rc = msc_fullinfo(regex, PCRE_INFO_JIT, &jit);
|
3660 | 3681 | #endif
|
|
0 commit comments