Skip to content

Commit

Permalink
re_capvm_compile: subtree_represents_character_class: handle empty b.
Browse files Browse the repository at this point in the history
The comment says this handles a .b that is EMPTY, but the recursive
call rejects it. Something in PCRE suite in CI is triggering this.
  • Loading branch information
silentbicycle committed Jul 25, 2023
1 parent 8f0a683 commit 722260a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/libre/re_capvm_compile.c
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,11 @@ subtree_represents_character_class(const struct ast_expr *expr, uint64_t cc[4])
}

uint64_t neg_cc[4];
if (subtree_represents_character_class(expr->u.subtract.b, neg_cc)) {
if (expr->u.subtract.b->type == AST_EXPR_EMPTY) {
for (size_t cc_i = 0; cc_i < 4; cc_i++) {
neg_cc[cc_i] = (uint64_t)0;
}
} else if (subtree_represents_character_class(expr->u.subtract.b, neg_cc)) {
for (size_t cc_i = 0; cc_i < 4; cc_i++) {
cc[cc_i] &=~ neg_cc[cc_i];
}
Expand Down

0 comments on commit 722260a

Please sign in to comment.