mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-08-17 00:36:07 +03:00
Fix segmentation fault in the regression tests
This commit is contained in:
parent
a168502717
commit
fd8578351d
@ -88,10 +88,14 @@ Rules::~Rules() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
/** Cleanup audit log */
|
/** Cleanup audit log */
|
||||||
|
if (audit_log) {
|
||||||
audit_log->refCountDecreaseAndCheck();
|
audit_log->refCountDecreaseAndCheck();
|
||||||
|
}
|
||||||
/** Cleanup debug log */
|
/** Cleanup debug log */
|
||||||
|
if (debugLog) {
|
||||||
debugLog->refCountDecreaseAndCheck();
|
debugLog->refCountDecreaseAndCheck();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -69,9 +69,9 @@ void actions(ModSecurityTestResults<RegressionTest> *r,
|
|||||||
void perform_unit_test(std::vector<RegressionTest *> *tests,
|
void perform_unit_test(std::vector<RegressionTest *> *tests,
|
||||||
ModSecurityTestResults<RegressionTest> *res, int *count) {
|
ModSecurityTestResults<RegressionTest> *res, int *count) {
|
||||||
|
|
||||||
CustomDebugLog *debug_log = new CustomDebugLog();
|
|
||||||
|
|
||||||
for (RegressionTest *t : *tests) {
|
for (RegressionTest *t : *tests) {
|
||||||
|
CustomDebugLog *debug_log = new CustomDebugLog();
|
||||||
ModSecurity::ModSecurity *modsec = NULL;
|
ModSecurity::ModSecurity *modsec = NULL;
|
||||||
ModSecurity::Rules *modsec_rules = NULL;
|
ModSecurity::Rules *modsec_rules = NULL;
|
||||||
ModSecurity::Assay *modsec_assay = NULL;
|
ModSecurity::Assay *modsec_assay = NULL;
|
||||||
@ -193,6 +193,7 @@ end:
|
|||||||
CustomDebugLog *d = reinterpret_cast<CustomDebugLog *>
|
CustomDebugLog *d = reinterpret_cast<CustomDebugLog *>
|
||||||
(modsec_rules->debugLog);
|
(modsec_rules->debugLog);
|
||||||
|
|
||||||
|
if (d != NULL) {
|
||||||
if (!d->contains(t->debug_log)) {
|
if (!d->contains(t->debug_log)) {
|
||||||
std::cout << "failed!" << std::endl;
|
std::cout << "failed!" << std::endl;
|
||||||
std::cout << "Debug log was not matching the expected results.";
|
std::cout << "Debug log was not matching the expected results.";
|
||||||
@ -209,18 +210,20 @@ end:
|
|||||||
|
|
||||||
std::cout << "Debug log:" << std::endl;
|
std::cout << "Debug log:" << std::endl;
|
||||||
std::cout << "" << d->log_messages() << "" <<std::endl;
|
std::cout << "" << d->log_messages() << "" <<std::endl;
|
||||||
after_debug_log:
|
}
|
||||||
|
|
||||||
|
after_debug_log:
|
||||||
|
if (d != NULL) {
|
||||||
res->log_raw_debug_log = d->log_messages();
|
res->log_raw_debug_log = d->log_messages();
|
||||||
|
}
|
||||||
|
|
||||||
delete modsec_assay;
|
delete modsec_assay;
|
||||||
delete modsec_rules;
|
delete modsec_rules;
|
||||||
delete modsec;
|
delete modsec;
|
||||||
|
delete debug_log;
|
||||||
|
|
||||||
res->insert(res->end(), r.begin(), r.end());
|
res->insert(res->end(), r.begin(), r.end());
|
||||||
}
|
}
|
||||||
|
|
||||||
delete debug_log;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user