summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--string.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/string.c b/string.c
index 3518cf5601..0efcf49b27 100644
--- a/string.c
+++ b/string.c
@@ -1363,6 +1363,7 @@ rb_str_resurrect(VALUE str)
* times (and call many realloc).
*/
+static inline void str_modifiable(VALUE str);
static VALUE
rb_str_init(int argc, VALUE *argv, VALUE str)
{
@@ -1414,6 +1415,9 @@ rb_str_init(int argc, VALUE *argv, VALUE str)
}
else if (n == 1) {
StringValue(orig);
+ if (OBJ_FROZEN(str)) {
+ rb_error_frozen_object(str);
+ }
str_replace(str, orig);
}
return str;