* encoding.c (rb_enc_compatible): check encoding incapable arguments.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15510 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
akr 2008-02-16 11:43:12 +00:00
parent 60fa63b819
commit 8bcfa698a0
2 changed files with 10 additions and 3 deletions

View File

@ -1,3 +1,7 @@
Sat Feb 16 18:13:53 2008 Tanaka Akira <akr@fsij.org>
* encoding.c (rb_enc_compatible): check encoding incapable arguments.
Sat Feb 16 20:12:47 2008 Tanaka Akira <akr@fsij.org> Sat Feb 16 20:12:47 2008 Tanaka Akira <akr@fsij.org>
* re.c (match_inspect): avoid SEGV with MatchData.allocate.inspect. * re.c (match_inspect): avoid SEGV with MatchData.allocate.inspect.
@ -108,7 +112,7 @@ Fri Feb 15 15:23:12 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
Fri Feb 15 10:35:54 2008 Nobuyoshi Nakada <nobu@ruby-lang.org> Fri Feb 15 10:35:54 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
* re.c (rb_reg_quote): set US-ACII for ASCII-only string. * re.c (rb_reg_quote): set US-ASCII for ASCII-only string.
[ruby-dev:33785] [ruby-dev:33785]
Fri Feb 15 10:27:47 2008 Nobuyoshi Nakada <nobu@ruby-lang.org> Fri Feb 15 10:27:47 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
@ -275,7 +279,7 @@ Tue Feb 12 15:27:19 2008 NARUSE, Yui <naruse@ruby-lang.org>
* bootstraptest/runner.rb, bootstraptest/test_method.rb, enc/depend, * bootstraptest/runner.rb, bootstraptest/test_method.rb, enc/depend,
instruby.rb, lib/mkmf.rb, lib/test/unit/util/procwrapper.rb, instruby.rb, lib/mkmf.rb, lib/test/unit/util/procwrapper.rb,
mkconfig.rb, sample/test.rb, template/vm.inc.tmpl, mkconfig.rb, sample/test.rb, template/vm.inc.tmpl,
test/ruby/test_stringchar.rb: fixes arround String#gsub. test/ruby/test_stringchar.rb: fixes around String#gsub.
Tue Feb 12 15:11:47 2008 NARUSE, Yui <naruse@ruby-lang.org> Tue Feb 12 15:11:47 2008 NARUSE, Yui <naruse@ruby-lang.org>
@ -290,7 +294,7 @@ Tue Feb 12 15:11:47 2008 NARUSE, Yui <naruse@ruby-lang.org>
lib/rexml/quickpath.rb, lib/rexml/text.rb, lib/rss/parser.rb, lib/rexml/quickpath.rb, lib/rexml/text.rb, lib/rss/parser.rb,
lib/uri/common.rb, lib/uri/generic.rb, lib/webrick/httpresponse.rb, lib/uri/common.rb, lib/uri/generic.rb, lib/webrick/httpresponse.rb,
lib/webrick/httpservlet/filehandler.rb, lib/yaml/baseemitter.rb, lib/webrick/httpservlet/filehandler.rb, lib/yaml/baseemitter.rb,
lib/yaml/encoding.rb: performance tuning arround String#gsub. lib/yaml/encoding.rb: performance tuning around String#gsub.
Tue Feb 12 12:16:45 2008 Yukihiro Matsumoto <matz@ruby-lang.org> Tue Feb 12 12:16:45 2008 Yukihiro Matsumoto <matz@ruby-lang.org>

View File

@ -659,6 +659,9 @@ rb_enc_compatible(VALUE str1, VALUE str2)
idx1 = rb_enc_get_index(str1); idx1 = rb_enc_get_index(str1);
idx2 = rb_enc_get_index(str2); idx2 = rb_enc_get_index(str2);
if (idx1 < 0 || idx2 < 0)
return 0;
if (idx1 == idx2) { if (idx1 == idx2) {
return rb_enc_from_index(idx1); return rb_enc_from_index(idx1);
} }