Skip to content
Permalink
Browse files Browse the repository at this point in the history
Merge pull request #134 from k-takata/fix-segv-in-error-str
Fix SEGV in onig_error_code_to_str() (Fix #132)
  • Loading branch information
k-takata committed Jul 29, 2019
2 parents 595e086 + 00cc7e2 commit 9827d5a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
6 changes: 5 additions & 1 deletion regparse.c
Expand Up @@ -3910,7 +3910,11 @@ fetch_token(OnigToken* tok, UChar** src, UChar* end, ScanEnv* env)

if (c == 'R' || c == '0') {
PINC; /* skip 'R' / '0' */
if (!PPEEK_IS(')')) return ONIGERR_INVALID_GROUP_NAME;
if (!PPEEK_IS(')')) {
r = ONIGERR_INVALID_GROUP_NAME;
onig_scan_env_set_error_string(env, r, p - 1, p + 1);
return r;
}
PINC; /* skip ')' */
name_end = name = p;
gnum = 0;
Expand Down
1 change: 1 addition & 0 deletions testpy.py
Expand Up @@ -1320,6 +1320,7 @@ def main():
n("\\M#", "", err=onigmo.ONIGERR_META_CODE_SYNTAX)
n("\\C", "", err=onigmo.ONIGERR_END_PATTERN_AT_CONTROL)
n("\\C#", "", err=onigmo.ONIGERR_CONTROL_CODE_SYNTAX)
n("(?0d", "", syn=onigmo.ONIG_SYNTAX_PERL, err=onigmo.ONIGERR_INVALID_GROUP_NAME) # Issue #132

# ONIG_OPTION_FIND_LONGEST option
x2("foo|foobar", "foobar", 0, 3)
Expand Down

0 comments on commit 9827d5a

Please sign in to comment.