[前][次][番号順一覧][スレッド一覧]

ruby-changes:46117

From: nagachika <ko1@a...>
Date: Tue, 28 Mar 2017 03:12:24 +0900 (JST)
Subject: [ruby-changes:46117] nagachika:r58188 (ruby_2_3): * regcomp.c (set_bm_skip): Need to check the end of the string.

nagachika	2017-03-28 03:12:18 +0900 (Tue, 28 Mar 2017)

  New Revision: 58188

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=58188

  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_3/regcomp.c
    branches/ruby_2_3/version.h
Index: ruby_2_3/version.h
===================================================================
--- ruby_2_3/version.h	(revision 58187)
+++ ruby_2_3/version.h	(revision 58188)
@@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_3/version.h#L1
 #define RUBY_VERSION "2.3.4"
 #define RUBY_RELEASE_DATE "2017-03-28"
-#define RUBY_PATCHLEVEL 297
+#define RUBY_PATCHLEVEL 298
 
 #define RUBY_RELEASE_YEAR 2017
 #define RUBY_RELEASE_MONTH 3
Index: ruby_2_3/regcomp.c
===================================================================
--- ruby_2_3/regcomp.c	(revision 58187)
+++ ruby_2_3/regcomp.c	(revision 58188)
@@ -4192,6 +4192,8 @@ set_bm_skip(UChar* s, UChar* end, regex_ https://github.com/ruby/ruby/blob/trunk/ruby_2_3/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_3/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_3/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_3/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))

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]