소스 검색

suppress backref processing in ERE regcomp

one of the features of ERE is that it's actually a regular language
and does not admit expressions which cannot be matched in linear time.
introduction of \n backref support into regcomp's ERE parsing was
unintentional.
Rich Felker 10 년 전
부모
커밋
7c8c86f630
1개의 변경된 파일1개의 추가작업 그리고 1개의 파일을 삭제
  1. 1 1
      src/regex/regcomp.c

+ 1 - 1
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 (isdigit(*s)) {
+			if (!ere && isdigit(*s)) {
 				/* back reference */
 				int val = *s - '0';
 				node = tre_ast_new_literal(ctx->mem, BACKREF, val, ctx->position);