From 458c447fdfbacfc5f8b3da40f103ca2bf8eb6ca2 Mon Sep 17 00:00:00 2001 From: duerst Date: Thu, 30 Jul 2009 09:40:06 +0000 Subject: * transcode.c: added check for frozen string for encode! (see Bug #1836) * test/ruby/test_transcode.rb: added tests for the above git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@24322 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- transcode.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'transcode.c') diff --git a/transcode.c b/transcode.c index ee6794d9b..9e4c8392c 100644 --- a/transcode.c +++ b/transcode.c @@ -2644,6 +2644,10 @@ str_encode_associate(VALUE str, int encidx) static VALUE str_encode_bang(int argc, VALUE *argv, VALUE str) { + if (OBJ_FROZEN(str)) { /* in future, may use str_frozen_check from string.c, but that's currently static */ + rb_raise(rb_eRuntimeError, "string frozen"); + } + VALUE newstr = str; int encidx = str_transcode(argc, argv, &newstr); -- cgit