[Bug #20752] Slice of readonly IO::Buffer also should be readonly

This commit is contained in:
Nobuyoshi Nakada 2024-09-30 16:24:03 +09:00
parent b93c51c114
commit 637067440f
No known key found for this signature in database
GPG key ID: 3582D74E1FEE4465
Notes: git 2024-09-30 11:40:03 +00:00
2 changed files with 13 additions and 0 deletions

View file

@ -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;