ruby-changes:47429
From: usa <ko1@a...>
Date: Wed, 9 Aug 2017 19:31:09 +0900 (JST)
Subject: [ruby-changes:47429] usa:r59545 (ruby_2_3): merge revision(s) 59384: [Backport #13759]
usa 2017-08-09 19:30:58 +0900 (Wed, 09 Aug 2017) New Revision: 59545 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=59545 Log: merge revision(s) 59384: [Backport #13759] strscan.c: fix segfault in aref * ext/strscan/strscan.c (strscan_aref): fix segfault after get_byte or getch which do not apply regexp. [ruby-core:82116] [Bug #13759] Modified directories: branches/ruby_2_3/ Modified files: branches/ruby_2_3/ChangeLog branches/ruby_2_3/ext/strscan/strscan.c branches/ruby_2_3/test/strscan/test_stringscanner.rb branches/ruby_2_3/version.h Index: ruby_2_3/ChangeLog =================================================================== --- ruby_2_3/ChangeLog (revision 59544) +++ ruby_2_3/ChangeLog (revision 59545) @@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_3/ChangeLog#L1 +Wed Aug 9 19:30:34 2017 Nobuyoshi Nakada <nobu@r...> + + * ext/strscan/strscan.c (strscan_aref): fix segfault after + get_byte or getch which do not apply regexp. + [Bug #13759] + Wed Aug 9 19:28:40 2017 Nobuyoshi Nakada <nobu@r...> * configure.in: add rpath flags which is needed for OPTDIR as well Index: ruby_2_3/ext/strscan/strscan.c =================================================================== --- ruby_2_3/ext/strscan/strscan.c (revision 59544) +++ ruby_2_3/ext/strscan/strscan.c (revision 59545) @@ -1034,6 +1034,7 @@ strscan_aref(VALUE self, VALUE idx) https://github.com/ruby/ruby/blob/trunk/ruby_2_3/ext/strscan/strscan.c#L1034 idx = rb_sym2str(idx); /* fall through */ case T_STRING: + if (!p->regex) return Qnil; RSTRING_GETMEM(idx, name, i); i = name_to_backref_number(&(p->regs), p->regex, name, name + i, rb_enc_get(idx)); break; Index: ruby_2_3/test/strscan/test_stringscanner.rb =================================================================== --- ruby_2_3/test/strscan/test_stringscanner.rb (revision 59544) +++ ruby_2_3/test/strscan/test_stringscanner.rb (revision 59545) @@ -718,4 +718,14 @@ class TestStringScanner < Test::Unit::Te https://github.com/ruby/ruby/blob/trunk/ruby_2_3/test/strscan/test_stringscanner.rb#L718 s.scan(/test strin/) assert_equal('#<StringScanner 10/16 "...strin" @ "g tes...">', s.inspect) end + + def test_aref_without_regex + s = StringScanner.new('abc') + s.get_byte + assert_nil(s[:c]) + assert_nil(s["c"]) + s.getch + assert_nil(s[:c]) + assert_nil(s["c"]) + end end Index: ruby_2_3/version.h =================================================================== --- ruby_2_3/version.h (revision 59544) +++ ruby_2_3/version.h (revision 59545) @@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_3/version.h#L1 #define RUBY_VERSION "2.3.5" #define RUBY_RELEASE_DATE "2017-08-09" -#define RUBY_PATCHLEVEL 355 +#define RUBY_PATCHLEVEL 356 #define RUBY_RELEASE_YEAR 2017 #define RUBY_RELEASE_MONTH 8 Index: ruby_2_3 =================================================================== --- ruby_2_3 (revision 59544) +++ ruby_2_3 (revision 59545) Property changes on: ruby_2_3 ___________________________________________________________________ Modified: svn:mergeinfo ## -0,0 +0,1 ## Merged /trunk:r59384 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/