Actions
Bug #20752
closedIO::Buffer#slice creates mutable IO::Buffer instance that points to readonly memory (e.g. fronzen String)
Bug #20752:
IO::Buffer#slice creates mutable IO::Buffer instance that points to readonly memory (e.g. fronzen String)
ruby -v:
ruby 3.4.0dev (2024-09-18T02:16:22Z master 4797b0704a) +PRISM [x86_64-linux]
Backport:
Description
irb(main):001> RUBY_DESCRIPTION.frozen?
=> true
irb(main):002> IO::Buffer.for(RUBY_DESCRIPTION).set_string('perl', 0, 4)
(irb):2:in 'IO::Buffer#set_string': Buffer is not writable! (IO::Buffer::AccessError)
from (irb):2:in '<main>'
from <internal:kernel>:191:in 'Kernel#loop'
from -e:1:in '<main>'
irb(main):003> IO::Buffer.for(RUBY_DESCRIPTION).slice.set_string('perl', 0, 4)
=> 4
irb(main):004> RUBY_DESCRIPTION
=> "perl 3.4.0dev (2024-09-18T02:16:22Z master 4797b0704a) +PRISM [x86_64-linux]"
Updated by nobu (Nobuyoshi Nakada) almost 2 years ago
- Backport changed from 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN to 3.1: REQUIRED, 3.2: REQUIRED, 3.3: REQUIRED
Updated by hanazuki (Kasumi Hanazuki) almost 2 years ago
- Subject changed from IO::Buffer#slice fails to copy readonly flag, allowing writes into frozen String to IO::Buffer#slice creates mutable IO::Buffer instance that points to readonly memory (e.g. fronzen String)
Updated by mame (Yusuke Endoh) almost 2 years ago
- Assignee set to ioquatix (Samuel Williams)
Updated by ioquatix (Samuel Williams) almost 2 years ago
The second example XameError is hilarious, what a great bug. Yes, this should be fixed.
Updated by ioquatix (Samuel Williams) almost 2 years ago
Looks like @nobu (Nobuyoshi Nakada) already made a PR here: https://github.com/ruby/ruby/pull/11735
Updated by nobu (Nobuyoshi Nakada) almost 2 years ago
- Status changed from Open to Closed
Updated by nagachika (Tomoyuki Chikanaga) almost 2 years ago
- Backport changed from 3.1: REQUIRED, 3.2: REQUIRED, 3.3: REQUIRED to 3.1: REQUIRED, 3.2: DONE, 3.3: REQUIRED
ruby_3_2 5777fe5ab57d6479326bdb21ef9a6b88ea1516dc merged revision(s) 637067440f74043c6d79fc649ab8acf1afea25a5.
Updated by k0kubun (Takashi Kokubun) over 1 year ago
- Backport changed from 3.1: REQUIRED, 3.2: DONE, 3.3: REQUIRED to 3.1: REQUIRED, 3.2: DONE, 3.3: DONE
ruby_3_3 12ea98e8c8af0ed6778aad26e7ec5f95e2c239e5 merged revision(s) 637067440f74043c6d79fc649ab8acf1afea25a5.
Actions