[BUGFIX]Clean up hit groups promptly during scanning

This commit is contained in:
liuwentan
2024-04-11 16:16:04 +08:00
parent 1b97f76bf5
commit 580d6faa0f
9 changed files with 294 additions and 255 deletions

View File

@@ -1026,6 +1026,11 @@ int expr_runtime_scan(struct expr_runtime *expr_rt, int thread_id,
const char *data, size_t data_len,
int vtable_id, struct maat_state *state)
{
//clear compile_state->last_hit_group
if (state != NULL && state->compile_state != NULL) {
compile_state_clear_last_hit_group(state->compile_state);
}
if (0 == expr_rt->rule_num) {
//empty expr table
return 0;
@@ -1116,11 +1121,21 @@ int expr_runtime_stream_scan(struct expr_runtime_stream *expr_rt_stream,
int vtable_id, struct maat_state *state)
{
struct expr_runtime *expr_rt = expr_rt_stream->ref_expr_rt;
//clear compile_state->last_hit_group
if (state != NULL && state->compile_state != NULL) {
compile_state_clear_last_hit_group(state->compile_state);
}
if (0 == expr_rt->rule_num) {
//empty expr table
return 0;
}
if (NULL == expr_rt_stream->handle) {
return 0;
}
size_t n_hit_item = 0;
size_t n_hit_pattern = 0;
struct expr_scan_result hit_results[MAX_HIT_ITEM_NUM];