From 199b59f065ce6f1c13b8424f35a70c513523211b Mon Sep 17 00:00:00 2001 From: Jemma Issroff Date: Wed, 9 Nov 2022 17:04:35 -0500 Subject: 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] --- pack.c | 1 + 1 file changed, 1 insertion(+) (limited to 'pack.c') diff --git a/pack.c b/pack.c index 2817491b77..294d7dfa35 100644 --- a/pack.c +++ b/pack.c @@ -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; } -- cgit v1.2.3