Skip to content
This repository was archived by the owner on Apr 24, 2025. It is now read-only.

Commit d1cf592

Browse files
committed
fix: Issue #253: Posix classes are not strict enough
1 parent 08d3611 commit d1cf592

File tree

1 file changed

+3
-21
lines changed

1 file changed

+3
-21
lines changed

src/regparse.c

Lines changed: 3 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -6582,8 +6582,7 @@ prs_posix_bracket(CClassNode* cc, UChar** src, UChar* end, ParseEnv* env)
65826582
};
65836583

65846584
PosixBracketEntryType *pb;
6585-
int not, i, r;
6586-
OnigCodePoint c;
6585+
int not, r;
65876586
OnigEncoding enc = env->enc;
65886587
UChar *p = *src;
65896588

@@ -6613,21 +6612,6 @@ prs_posix_bracket(CClassNode* cc, UChar** src, UChar* end, ParseEnv* env)
66136612
}
66146613

66156614
not_posix_bracket:
6616-
c = 0;
6617-
i = 0;
6618-
while (!PEND && ((c = PPEEK) != ':') && c != ']') {
6619-
PINC_S;
6620-
if (++i > POSIX_BRACKET_CHECK_LIMIT_LENGTH) break;
6621-
}
6622-
if (c == ':' && ! PEND) {
6623-
PINC_S;
6624-
if (! PEND) {
6625-
PFETCH_S(c);
6626-
if (c == ']')
6627-
return ONIGERR_INVALID_POSIX_BRACKET_TYPE;
6628-
}
6629-
}
6630-
66316615
return 1; /* 1: is not POSIX bracket, but no error. */
66326616
}
66336617

@@ -6950,11 +6934,8 @@ prs_cc(Node** np, PToken* tok, UChar** src, UChar* end, ParseEnv* env)
69506934
r = prs_posix_bracket(cc, &p, end, env);
69516935
if (r < 0) goto err;
69526936
if (r == 1) { /* is not POSIX bracket */
6953-
CC_ESC_WARN(env, (UChar* )"[");
69546937
p = tok->backp;
6955-
in_code = tok->u.code;
6956-
in_raw = 0;
6957-
goto val_entry;
6938+
goto cc_open_in_cc;
69586939
}
69596940
goto next_cprop;
69606941
break;
@@ -7046,6 +7027,7 @@ prs_cc(Node** np, PToken* tok, UChar** src, UChar* end, ParseEnv* env)
70467027
break;
70477028

70487029
case TK_CC_OPEN_CC: /* [ */
7030+
cc_open_in_cc:
70497031
{
70507032
Node *anode;
70517033
CClassNode* acc;

0 commit comments

Comments
 (0)