diff options
author | Peter Zhu <[email protected]> | 2024-02-02 12:00:21 -0500 |
---|---|---|
committer | Peter Zhu <[email protected]> | 2024-02-05 11:11:07 -0500 |
commit | 5e0c17145131e073814c7e5b15227d0b4e73cabe (patch) | |
tree | 9d076dd1c6de347808295e70b75e4d6379e626d5 /io.c | |
parent | 02c88477ceb8d679a815721d16ce248da845cff6 (diff) |
Make io_fwrite safe for compaction
[Bug #20169]
Embedded strings are not safe for system calls without the GVL because
compaction can cause pages to be locked causing the operation to fail
with EFAULT. This commit changes io_fwrite to use rb_str_tmp_frozen_no_embed_acquire,
which guarantees that the return string is not embedded.
Diffstat (limited to 'io.c')
-rw-r--r-- | io.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -1975,7 +1975,7 @@ io_fwrite(VALUE str, rb_io_t *fptr, int nosync) if (converted) OBJ_FREEZE(str); - tmp = rb_str_tmp_frozen_acquire(str); + tmp = rb_str_tmp_frozen_no_embed_acquire(str); RSTRING_GETMEM(tmp, ptr, len); n = io_binwrite(tmp, ptr, len, fptr, nosync); rb_str_tmp_frozen_release(str, tmp); |