ruby-changes:46031
From: usa <ko1@a...>
Date: Sun, 26 Mar 2017 01:58:08 +0900 (JST)
Subject: [ruby-changes:46031] usa:r58102 (ruby_2_2): * regcomp.c (set_bm_skip): Need to check the end of the string.
usa 2017-03-26 01:58:03 +0900 (Sun, 26 Mar 2017) New Revision: 58102 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=58102 Log: * regcomp.c (set_bm_skip): Need to check the end of the string. this patch is from https://github.com/k-takata/Onigmo/commit/e5c0e6c36187898bb27960cd66d591f172558848 . [Backport #12997] Modified files: branches/ruby_2_2/regcomp.c branches/ruby_2_2/version.h Index: ruby_2_2/regcomp.c =================================================================== --- ruby_2_2/regcomp.c (revision 58101) +++ ruby_2_2/regcomp.c (revision 58102) @@ -4192,6 +4192,8 @@ set_bm_skip(UChar* s, UChar* end, regex_ https://github.com/ruby/ruby/blob/trunk/ruby_2_2/regcomp.c#L4192 n = ONIGENC_GET_CASE_FOLD_CODES_BY_STR(enc, reg->case_fold_flag, p, end, items); clen = enclen(enc, p, end); + if (p + clen > end) + clen = (int )(end - p); for (j = 0; j < n; j++) { if ((items[j].code_len != 1) || (items[j].byte_len != clen)) @@ -4222,6 +4224,8 @@ set_bm_skip(UChar* s, UChar* end, regex_ https://github.com/ruby/ruby/blob/trunk/ruby_2_2/regcomp.c#L4224 n = ONIGENC_GET_CASE_FOLD_CODES_BY_STR(enc, reg->case_fold_flag, p, end, items); clen = enclen(enc, p, end); + if (p + clen > end) + clen = (int )(end - p); for (j = 0; j < n; j++) { if ((items[j].code_len != 1) || (items[j].byte_len != clen)) @@ -4265,6 +4269,8 @@ set_bm_skip(UChar* s, UChar* end, regex_ https://github.com/ruby/ruby/blob/trunk/ruby_2_2/regcomp.c#L4269 n = ONIGENC_GET_CASE_FOLD_CODES_BY_STR(enc, reg->case_fold_flag, p, end, items); clen = enclen(enc, p, end); + if (p + clen > end) + clen = (int )(end - p); for (j = 0; j < n; j++) { if ((items[j].code_len != 1) || (items[j].byte_len != clen)) @@ -4295,6 +4301,8 @@ set_bm_skip(UChar* s, UChar* end, regex_ https://github.com/ruby/ruby/blob/trunk/ruby_2_2/regcomp.c#L4301 n = ONIGENC_GET_CASE_FOLD_CODES_BY_STR(enc, reg->case_fold_flag, p, end, items); clen = enclen(enc, p, end); + if (p + clen > end) + clen = (int )(end - p); for (j = 0; j < n; j++) { if ((items[j].code_len != 1) || (items[j].byte_len != clen)) Index: ruby_2_2/version.h =================================================================== --- ruby_2_2/version.h (revision 58101) +++ ruby_2_2/version.h (revision 58102) @@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_2/version.h#L1 #define RUBY_VERSION "2.2.7" #define RUBY_RELEASE_DATE "2017-03-26" -#define RUBY_PATCHLEVEL 434 +#define RUBY_PATCHLEVEL 435 #define RUBY_RELEASE_YEAR 2017 #define RUBY_RELEASE_MONTH 3 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/