From 7285c1fdc48d9788db39a0764abb9ec0b0a80565 Mon Sep 17 00:00:00 2001 From: Rainer Kottenhoff Date: Sat, 11 Jul 2020 14:41:19 +0200 Subject: [PATCH] + upd: Oniguruma bug fixes --- oniguruma/doc/API | 32 +++++++++++++++++++++++--------- oniguruma/src/regexec.c | 7 +++++++ 2 files changed, 30 insertions(+), 9 deletions(-) diff --git a/oniguruma/doc/API b/oniguruma/doc/API index 7362f3046..6b87b43fe 100644 --- a/oniguruma/doc/API +++ b/oniguruma/doc/API @@ -1,4 +1,4 @@ -Oniguruma API Version 6.9.6 2020/05/20 +Oniguruma API Version 6.9.6 2020/07/05 #include @@ -335,8 +335,11 @@ Oniguruma API Version 6.9.6 2020/05/20 6 region: address for return group match range info (NULL is allowed) 7 option: search time option - ONIG_OPTION_NOTBOL string head(str) isn't considered as begin of line - ONIG_OPTION_NOTEOL string end (end) isn't considered as end of line + ONIG_OPTION_NOTBOL (str) isn't considered as begin of line and begin of string (* ONIG_OPTION_NOT_BEGIN_STRING) + ONIG_OPTION_NOTEOL (end) isn't considered as end of line and end of string (* ONIG_OPTION_NOT_END_STRING) + ONIG_OPTION_NOT_BEGIN_STRING (str) isn't considered as begin of string (* fail \A) + ONIG_OPTION_NOT_END_STRING (end) isn't considered as end of string (* fail \z, \Z) + ONIG_OPTION_NOT_BEGIN_POSITION (start) isn't considered as start position of search (* fail \G) # int onig_search_with_param(regex_t* reg, const UChar* str, const UChar* end, @@ -369,8 +372,11 @@ Oniguruma API Version 6.9.6 2020/05/20 5 region: address for return group match range info (NULL is allowed) 6 option: search time option - ONIG_OPTION_NOTBOL string head(str) isn't considered as begin of line - ONIG_OPTION_NOTEOL string end (end) isn't considered as end of line + ONIG_OPTION_NOTBOL (str) isn't considered as begin of line and begin of string (* ONIG_OPTION_NOT_BEGIN_STRING) + ONIG_OPTION_NOTEOL (end) isn't considered as end of line and end of string (* ONIG_OPTION_NOT_END_STRING) + ONIG_OPTION_NOT_BEGIN_STRING (str) isn't considered as begin of string (* fail \A) + ONIG_OPTION_NOT_END_STRING (end) isn't considered as end of string (* fail \z, \Z) + ONIG_OPTION_NOT_BEGIN_POSITION (at) isn't considered as start position of search (* fail \G) # int onig_match_with_param(regex_t* reg, const UChar* str, const UChar* end, @@ -502,8 +508,12 @@ Oniguruma API Version 6.9.6 2020/05/20 ONIG_REGSET_REGEX_LEAD (returns most left position) ONIG_REGSET_PRIORITY_TO_REGEX_ORDER (returns first match regex) 7 option: search time option - ONIG_OPTION_NOTBOL string head(str) isn't considered as begin of line - ONIG_OPTION_NOTEOL string end (end) isn't considered as end of line + ONIG_OPTION_NOTBOL (str) isn't considered as begin of line and begin of string (* ONIG_OPTION_NOT_BEGIN_STRING) + ONIG_OPTION_NOTEOL end (end) isn't considered as end of line and end of string (* ONIG_OPTION_NOT_END_STRING) + ONIG_OPTION_NOT_BEGIN_STRING (str) isn't considered as begin of string (* fail \A) + ONIG_OPTION_NOT_END_STRING (end) isn't considered as end of string (* fail \z, \Z) + ONIG_OPTION_NOT_BEGIN_POSITION (start) isn't considered as start position of search (* fail \G) + 8 rmatch_pos: return address of match position (match_address - str) * ONIG_REGSET_POSITION_LEAD and ONIG_REGSET_REGEX_LEAD return the same result. @@ -531,8 +541,12 @@ Oniguruma API Version 6.9.6 2020/05/20 ONIG_REGSET_REGEX_LEAD (returns most left position) ONIG_REGSET_PRIORITY_TO_REGEX_ORDER (returns first match regex) 7 option: search time option - ONIG_OPTION_NOTBOL string head(str) isn't considered as begin of line - ONIG_OPTION_NOTEOL string end (end) isn't considered as end of line + ONIG_OPTION_NOTBOL (str) isn't considered as begin of line and begin of string (* ONIG_OPTION_NOT_BEGIN_STRING) + ONIG_OPTION_NOTEOL (end) isn't considered as end of line and end of string (* ONIG_OPTION_NOT_END_STRING) + ONIG_OPTION_NOT_BEGIN_STRING (str) isn't considered as begin of string (* fail \A) + ONIG_OPTION_NOT_END_STRING (end) isn't considered as end of string (* fail \z, \Z) + ONIG_OPTION_NOT_BEGIN_POSITION (start) isn't considered as start position of search (* fail \G) + 8 mps: array of match-params 9 rmatch_pos: return address of match position (match_address - str) diff --git a/oniguruma/src/regexec.c b/oniguruma/src/regexec.c index 7999df276..ccfdbb558 100644 --- a/oniguruma/src/regexec.c +++ b/oniguruma/src/regexec.c @@ -3557,6 +3557,7 @@ match_at(regex_t* reg, const UChar* str, const UChar* end, CASE_OP(BEGIN_BUF) if (! ON_STR_BEGIN(s)) goto fail; + if (OPTON_NOTBOL(msa->options)) goto fail; if (OPTON_NOT_BEGIN_STRING(msa->options)) goto fail; INC_OP; @@ -3564,6 +3565,7 @@ match_at(regex_t* reg, const UChar* str, const UChar* end, CASE_OP(END_BUF) if (! ON_STR_END(s)) goto fail; + if (OPTON_NOTEOL(msa->options)) goto fail; if (OPTON_NOT_END_STRING(msa->options)) goto fail; INC_OP; @@ -3611,6 +3613,7 @@ match_at(regex_t* reg, const UChar* str, const UChar* end, if (IS_EMPTY_STR || !ONIGENC_IS_MBC_NEWLINE(encode, sprev, end)) { #endif if (OPTON_NOTEOL(msa->options)) goto fail; + if (OPTON_NOT_END_STRING(msa->options)) goto fail; INC_OP; JUMP_OUT; #ifndef USE_NEWLINE_AT_END_OF_STRING_HAS_EMPTY_LINE @@ -3619,6 +3622,8 @@ match_at(regex_t* reg, const UChar* str, const UChar* end, } else if (ONIGENC_IS_MBC_NEWLINE(encode, s, end) && ON_STR_END(s + enclen(encode, s))) { + if (OPTON_NOTEOL(msa->options)) goto fail; + if (OPTON_NOT_END_STRING(msa->options)) goto fail; INC_OP; JUMP_OUT; } @@ -3627,6 +3632,8 @@ match_at(regex_t* reg, const UChar* str, const UChar* end, UChar* ss = s + enclen(encode, s); ss += enclen(encode, ss); if (ON_STR_END(ss)) { + if (OPTON_NOTEOL(msa->options)) goto fail; + if (OPTON_NOT_END_STRING(msa->options)) goto fail; INC_OP; JUMP_OUT; }