Actions
Bug #20883
closedsprintf with binary strings has incorrect coderange
Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 3.3.5 (2024-09-03 revision ef084cc8f4) [x86_64-linux]
Description
In 9dc6065 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.
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.
Actions
Like0
Like0Like0Like0Like0