summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-02-16 11:43:12 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-02-16 11:43:12 +0000
commit8bcfa698a040698247ca20006a4aa4b6c1978c4b (patch)
tree4e9589f7ba6772d8cbe0803ebedf11eee530dd7c
parent60fa63b819e12601eb4ad88faa52548ef389aabb (diff)
* 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
-rw-r--r--ChangeLog10
-rw-r--r--encoding.c3
2 files changed, 10 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index c609c0d145..35a49c22ed 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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>
* 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>
- * 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]
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,
instruby.rb, lib/mkmf.rb, lib/test/unit/util/procwrapper.rb,
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>
@@ -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/uri/common.rb, lib/uri/generic.rb, lib/webrick/httpresponse.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>
diff --git a/encoding.c b/encoding.c
index 335d1ae00c..15a0687281 100644
--- a/encoding.c
+++ b/encoding.c
@@ -659,6 +659,9 @@ rb_enc_compatible(VALUE str1, VALUE str2)
idx1 = rb_enc_get_index(str1);
idx2 = rb_enc_get_index(str2);
+ if (idx1 < 0 || idx2 < 0)
+ return 0;
+
if (idx1 == idx2) {
return rb_enc_from_index(idx1);
}