X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=src%2Fregex%2Fregcomp.c;h=330de46759730b55b90d9080fb7798d37ae5db86;hb=140ad50cbf9244eecc21a0126c743396a34e8106;hp=4d80cb1c602ca5d53848c4535db0f1cb88d85aee;hpb=7c8c86f6308c7e0816b9638465a5917b12159e8f;p=musl diff --git a/src/regex/regcomp.c b/src/regex/regcomp.c index 4d80cb1c..330de467 100644 --- a/src/regex/regcomp.c +++ b/src/regex/regcomp.c @@ -839,7 +839,7 @@ static reg_errcode_t parse_atom(tre_parse_ctx_t *ctx, const char *s) s--; break; default: - if (!ere && isdigit(*s)) { + if (!ere && (unsigned)*s-'1' < 9) { /* back reference */ int val = *s - '0'; node = tre_ast_new_literal(ctx->mem, BACKREF, val, ctx->position); @@ -1584,7 +1584,8 @@ tre_add_tags(tre_mem_t mem, tre_stack_t *stack, tre_ast_node_t *tree, { status = tre_add_tag_right(mem, left, tag_left); tnfa->tag_directions[tag_left] = TRE_TAG_MAXIMIZE; - status = tre_add_tag_right(mem, right, tag_right); + if (status == REG_OK) + status = tre_add_tag_right(mem, right, tag_right); tnfa->tag_directions[tag_right] = TRE_TAG_MAXIMIZE; } num_tags += 2; @@ -1700,6 +1701,11 @@ tre_copy_ast(tre_mem_t mem, tre_stack_t *stack, tre_ast_node_t *ast, *result = tre_ast_new_literal(mem, min, max, pos); if (*result == NULL) status = REG_ESPACE; + else { + tre_literal_t *p = (*result)->obj; + p->class = lit->class; + p->neg_classes = lit->neg_classes; + } if (pos > *max_pos) *max_pos = pos;