diff options
author | Jemma Issroff <jemmaissroff@gmail.com> | 2022-11-09 17:04:35 -0500 |
---|---|---|
committer | Peter Zhu <peter@peterzhu.ca> | 2022-11-10 09:26:37 -0500 |
commit | 199b59f065ce6f1c13b8424f35a70c513523211b (patch) | |
tree | d12bed8a9afdb67684bf904be9bba706e09bfe7c /pack.c | |
parent | 68bd1d685579f9ae96f1c8160cf1fd9820e508da (diff) |
Fix bug in array pack with shared strings
If string literals are long and they become shared, we need to make them
independent before we can write to them. [Bug #19116]
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/6704
Diffstat (limited to 'pack.c')
-rw-r--r-- | pack.c | 1 |
1 files changed, 1 insertions, 0 deletions
@@ -217,6 +217,7 @@ pack_pack(rb_execution_context_t *ec, VALUE ary, VALUE fmt, VALUE buffer) else { if (!RB_TYPE_P(buffer, T_STRING)) rb_raise(rb_eTypeError, "buffer must be String, not %s", rb_obj_classname(buffer)); + rb_str_modify(buffer); res = buffer; } |