[#120465] [Ruby master Bug#20998] rb_str_locktmp() changes flags of frozen strings and string literals — "Eregon (Benoit Daloze) via ruby-core" <ruby-core@...>
Issue #20998 has been reported by Eregon (Benoit Daloze).
17 messages
2025/01/03
[ruby-core:120677] [Ruby master Bug#20883] sprintf with binary strings has incorrect coderange
From:
"k0kubun (Takashi Kokubun) via ruby-core" <ruby-core@...>
Date:
2025-01-15 01:42:04 UTC
List:
ruby-core #120677
Issue #20883 has been updated by k0kubun (Takashi Kokubun).
Backport changed from 3.1: DONTNEED, 3.2: DONE, 3.3: REQUIRED to 3.1: DONTNEED, 3.2: DONE, 3.3: DONE
`ruby_3_3` merged https://github.com/ruby/ruby/pull/12040. Thank you!
----------------------------------------
Bug #20883: sprintf with binary strings has incorrect coderange
https://bugs.ruby-lang.org/issues/20883#change-111500
* Author: jhawthorn (John Hawthorn)
* Status: Closed
* ruby -v: ruby 3.3.5 (2024-09-03 revision ef084cc8f4) [x86_64-linux]
* Backport: 3.1: DONTNEED, 3.2: DONE, 3.3: DONE
----------------------------------------
In [9dc6065](https://github.com/ruby/ruby/commit/9dc60653db186b1ae9400ed75b413a07728ce6ff) we stopped updating the coderange when the encoding became ENCINDEX_ASCII_8BIT. Though ASCII-8BIT (binary) can't ever have a broken coderange, it does need to distinguish between 7bit and valid.
``` ruby
puts ("%s" % "\xe2".b).ascii_only?
# => false from Ruby 2.1 to 3.1
# => true (incorrect) on Ruby 3.2 and 3.3
# => false again on HEAD
```
This was fixed in master as part of #20189, which clears the coderange in more cases of `rb_str_resize` which happens to fix this, but we shouldn't rely on it.
https://github.com/ruby/ruby/pull/12029
--
https://bugs.ruby-lang.org/
______________________________________________
ruby-core mailing list -- ruby-core@ml.ruby-lang.org
To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org
ruby-core info -- https://ml.ruby-lang.org/mailman3/lists/ruby-core.ml.ruby-lang.org/