X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=src%2Fregex%2Fregcomp.c;h=322a5e67c437c2cd838240bd67e3100be2a3ab3c;hb=0d4d1a96e4fd827267250e469affc7ebfc44324f;hp=5f119d172e535a5ca8d6b0289ac1391e9913d045;hpb=a5a47783359dff3e583693bcddc1c5e3311d96ac;p=musl diff --git a/src/regex/regcomp.c b/src/regex/regcomp.c index 5f119d17..322a5e67 100644 --- a/src/regex/regcomp.c +++ b/src/regex/regcomp.c @@ -1052,8 +1052,6 @@ tre_parse(tre_parse_ctx_t *ctx) } case PARSE_UNION: - if (!*ctx->re) - break; switch (*ctx->re) { case CHAR_PIPE: @@ -1086,8 +1084,6 @@ tre_parse(tre_parse_ctx_t *ctx) case PARSE_POSTFIX: /* Parse postfix operators. */ - if (!*ctx->re) - break; switch (*ctx->re) { case CHAR_PLUS: @@ -1186,7 +1182,7 @@ tre_parse(tre_parse_ctx_t *ctx) ctx->re++; goto lparen; } - if (!(ctx->cflags & REG_EXTENDED) && *(ctx->re + 1) == CHAR_LPAREN) + if (!(ctx->cflags & REG_EXTENDED) && *(ctx->re + 1) == CHAR_RPAREN) { goto empty_atom; } @@ -1210,7 +1206,7 @@ tre_parse(tre_parse_ctx_t *ctx) } } - if (!*ctx->re) + if (!ctx->re[1]) /* Trailing backslash. */ return REG_EESCAPE; @@ -1353,6 +1349,8 @@ tre_parse(tre_parse_ctx_t *ctx) if (ctx->cflags & REG_EXTENDED || ctx->re == ctx->re_start) { + if (!(ctx->cflags & REG_EXTENDED)) + STACK_PUSHX(stack, int, PARSE_CATENATION); result = tre_ast_new_literal(ctx->mem, ASSERTION, ASSERT_AT_BOL, -1); if (result == NULL)