summaryrefslogtreecommitdiff
path: root/io_buffer.c
diff options
context:
space:
mode:
authorNobuyoshi Nakada <[email protected]>2024-09-30 16:24:03 +0900
committerNobuyoshi Nakada <[email protected]>2024-09-30 20:39:14 +0900
commit637067440f74043c6d79fc649ab8acf1afea25a5 (patch)
treea95e6961ba6754b250dbfcc86132f7f72823b7d3 /io_buffer.c
parentb93c51c114c2b3c8f9845f3a7bd2c936baf0996d (diff)
[Bug #20752] Slice of readonly `IO::Buffer` also should be readonly
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/11735
Diffstat (limited to 'io_buffer.c')
-rw-r--r--io_buffer.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/io_buffer.c b/io_buffer.c
index e6ca61bdae..2e789abe0f 100644
--- a/io_buffer.c
+++ b/io_buffer.c
@@ -1532,6 +1532,7 @@ rb_io_buffer_slice(struct rb_io_buffer *buffer, VALUE self, size_t offset, size_
struct rb_io_buffer *slice = NULL;
TypedData_Get_Struct(instance, struct rb_io_buffer, &rb_io_buffer_type, slice);
+ slice->flags |= (buffer->flags & RB_IO_BUFFER_READONLY);
slice->base = (char*)buffer->base + offset;
slice->size = length;