summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzhengchao <[email protected]>2020-07-31 19:30:16 +0800
committerzhengchao <[email protected]>2020-07-31 19:30:16 +0800
commit5931b445ff16aa9e5bae94e06d844466224c0c0c (patch)
tree2d681b1fc3e3508849be2ae301f3b9b417edb241
parent9eac53c0abbe51648b1918ac84a37e97bcfc6b70 (diff)
增加对group_num为0的编译配置的处理。v3.0.3
-rw-r--r--src/entry/Maat_hierarchy.cpp11
-rw-r--r--src/entry/Maat_rule.cpp2
2 files changed, 10 insertions, 3 deletions
diff --git a/src/entry/Maat_hierarchy.cpp b/src/entry/Maat_hierarchy.cpp
index b97f50f..7965a66 100644
--- a/src/entry/Maat_hierarchy.cpp
+++ b/src/entry/Maat_hierarchy.cpp
@@ -331,7 +331,7 @@ int Maat_hierarchy_compile_add(struct Maat_hierarchy* hier, int compile_id, int
HASH_FIND_INT(hier->hash_compile_by_id, &compile_id, compile);
if(!compile)
{
- assert(declared_clause_num>0);
+ assert(declared_clause_num>=0);
compile=Maat_hierarchy_compile_new(hier, compile_id);
compile->declared_clause_num=declared_clause_num;
compile->user_data=user_data;
@@ -791,7 +791,8 @@ static struct bool_matcher* Maat_hierarchy_build_bool_matcher(struct Maat_hierar
j++;
}
}
- if(j==compile->declared_clause_num)
+ //some compile may have zero groups, e.g. default policy.
+ if(j==compile->declared_clause_num&&j>0)
{
bool_expr_array[expr_cnt].user_tag=compile;
bool_expr_array[expr_cnt].item_num=j;
@@ -802,6 +803,12 @@ static struct bool_matcher* Maat_hierarchy_build_bool_matcher(struct Maat_hierar
//Final STEP, build the bool matcher.
size_t mem_size=0;
+ if(expr_cnt==0)
+ {
+ MESA_handle_runtime_log(hier->logger, RLOG_LV_FATAL, module_maat_hierarchy,
+ "No expr to build.");
+ return NULL;
+ }
bm=bool_matcher_new(bool_expr_array, expr_cnt, hier->thread_num, &mem_size);
if(bm!=NULL)
{
diff --git a/src/entry/Maat_rule.cpp b/src/entry/Maat_rule.cpp
index 6d829a3..0b6f481 100644
--- a/src/entry/Maat_rule.cpp
+++ b/src/entry/Maat_rule.cpp
@@ -34,7 +34,7 @@
#include "stream_fuzzy_hash.h"
#include "gram_index_engine.h"
-int MAAT_FRAME_VERSION_3_0_20200724=1;
+int MAAT_FRAME_VERSION_3_0_20200731=1;
int is_valid_table_name(const char* str)
{