libsepol/cil: Limit the number of active line marks
A line mark functions like an open parenthesis, so the number of active line marks should be limited like the number of open parenthesis. This issue was found by the secilc-fuzzer. Signed-off-by: James Carter <jwcart2@gmail.com> Acked-by: Nicolas Iooss <nicolas.iooss@m4x.org>
This commit is contained in:
parent
d0b5ba03ba
commit
ff143e5298
1 changed files with 4 additions and 0 deletions
|
@ -131,6 +131,10 @@ static int add_hll_linemark(struct cil_tree_node **current, uint32_t *hll_offset
|
|||
*current = (*current)->parent;
|
||||
} else {
|
||||
push_hll_info(stack, *hll_offset, *hll_expand);
|
||||
if (cil_stack_number_of_items(stack) > CIL_PARSER_MAX_EXPR_DEPTH) {
|
||||
cil_log(CIL_ERR, "Number of active line marks exceeds limit of %d\n", CIL_PARSER_MAX_EXPR_DEPTH);
|
||||
goto exit;
|
||||
}
|
||||
|
||||
create_node(&node, *current, tok.line, *hll_offset, NULL);
|
||||
insert_node(node, *current);
|
||||
|
|
Loading…
Reference in a new issue