summaryrefslogtreecommitdiff
path: root/regparse.c
diff options
context:
space:
mode:
authorJeremy Evans <code@jeremyevans.net>2020-11-23 11:03:15 -0800
committerBenoit Daloze <eregontp@gmail.com>2020-11-24 16:01:30 +0100
commitb26d6c70e0f08050ca23388bb0e8442f73269c73 (patch)
tree04385765f23c92077edd5c37b35cd93344ddb1ee /regparse.c
parent237cb94cf5676e8cfc81ca9f5e8d29e04e61fc4d (diff)
Detect the premature end of char property in regexp
Default to ONIGERR_INVALID_CHAR_PROPERTY_NAME in fetch_char_property_to_ctype and only set otherwise if an ending } is found. Fixes [Bug #17340]
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/3807
Diffstat (limited to 'regparse.c')
-rw-r--r--regparse.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/regparse.c b/regparse.c
index a96c8c2fa7..7639db3bbe 100644
--- a/regparse.c
+++ b/regparse.c
@@ -4348,7 +4348,7 @@ fetch_char_property_to_ctype(UChar** src, UChar* end, ScanEnv* env)
OnigEncoding enc = env->enc;
UChar *prev, *start, *p = *src;
- r = 0;
+ r = ONIGERR_INVALID_CHAR_PROPERTY_NAME;
start = prev = p;
while (!PEND) {
@@ -4362,7 +4362,6 @@ fetch_char_property_to_ctype(UChar** src, UChar* end, ScanEnv* env)
return r;
}
else if (c == '(' || c == ')' || c == '{' || c == '|') {
- r = ONIGERR_INVALID_CHAR_PROPERTY_NAME;
break;
}
}