summaryrefslogtreecommitdiff
path: root/transcode.c
diff options
context:
space:
mode:
authorduerst <duerst@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-07-30 09:40:06 +0000
committerduerst <duerst@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-07-30 09:40:06 +0000
commit5e85648b770f6999bc0020ddddfe0bcdbf5149c5 (patch)
treef6397cd73df1fea3bc3a0328ec5e568110691dc4 /transcode.c
parentb8b083dbd5444007645a667dcb9d7a30e1e44b0b (diff)
* 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: svn+ssh://ci.ruby-lang.org/ruby/trunk@24322 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'transcode.c')
-rw-r--r--transcode.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/transcode.c b/transcode.c
index ee6794d9be..9e4c8392c6 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);