fix: rx operators better null checks

This commit is contained in:
Burkov Egor 2025-07-29 13:18:48 +03:00
parent 08b70e006b
commit c60709a58c
2 changed files with 22 additions and 19 deletions

View File

@ -68,6 +68,7 @@ bool Rx::evaluate(Transaction *transaction, RuleWithActions *rule,
// FIXME: DRY regex error reporting. This logic is currently duplicated in other operators. // FIXME: DRY regex error reporting. This logic is currently duplicated in other operators.
if (regex_result != Utils::RegexResult::Ok) { if (regex_result != Utils::RegexResult::Ok) {
if (transaction) {
transaction->m_variableMscPcreError.set("1", transaction->m_variableOffset); transaction->m_variableMscPcreError.set("1", transaction->m_variableOffset);
std::string regex_error_str = "OTHER"; std::string regex_error_str = "OTHER";
@ -79,7 +80,7 @@ bool Rx::evaluate(Transaction *transaction, RuleWithActions *rule,
} }
ms_dbg_a(transaction, 1, "rx: regex error '" + regex_error_str + "' for pattern '" + re->pattern + "'"); ms_dbg_a(transaction, 1, "rx: regex error '" + regex_error_str + "' for pattern '" + re->pattern + "'");
}
return false; return false;
} }

View File

@ -62,6 +62,7 @@ bool RxGlobal::evaluate(Transaction *transaction, RuleWithActions *rule,
// FIXME: DRY regex error reporting. This logic is currently duplicated in other operators. // FIXME: DRY regex error reporting. This logic is currently duplicated in other operators.
if (regex_result != Utils::RegexResult::Ok) { if (regex_result != Utils::RegexResult::Ok) {
if (transaction) {
transaction->m_variableMscPcreError.set("1", transaction->m_variableOffset); transaction->m_variableMscPcreError.set("1", transaction->m_variableOffset);
std::string regex_error_str = "OTHER"; std::string regex_error_str = "OTHER";
@ -73,6 +74,7 @@ bool RxGlobal::evaluate(Transaction *transaction, RuleWithActions *rule,
} }
ms_dbg_a(transaction, 1, "rxGlobal: regex error '" + regex_error_str + "' for pattern '" + re->pattern + "'"); ms_dbg_a(transaction, 1, "rxGlobal: regex error '" + regex_error_str + "' for pattern '" + re->pattern + "'");
}
return false; return false;
} }