[#116016] [Ruby master Bug#20150] Memory leak in grapheme clusters — "peterzhu2118 (Peter Zhu) via ruby-core" <ruby-core@...>
Issue #20150 has been reported by peterzhu2118 (Peter Zhu).
7 messages
2024/01/04
[#116382] [Ruby master Feature#20205] Enable `frozen_string_literal` by default — "byroot (Jean Boussier) via ruby-core" <ruby-core@...>
Issue #20205 has been reported by byroot (Jean Boussier).
77 messages
2024/01/23
[ruby-core:116231] [Ruby master Bug#20189] `rb_str_resize` does not clear coderange when expanding
From:
"byroot (Jean Boussier) via ruby-core" <ruby-core@...>
Date:
2024-01-16 14:08:42 UTC
List:
ruby-core #116231
Issue #20189 has been updated by byroot (Jean Boussier).
> Expanding string in some encoding (utf16 utf32) can change coderange to either valid or broken,
I must admit I'm not very familiar with wide char encodings, but this surprises me a bit. Ruby strings should always have their terminator, so I don't see how expanding a string would change their interpretation.
----------------------------------------
Bug #20189: `rb_str_resize` does not clear coderange when expanding
https://bugs.ruby-lang.org/issues/20189#change-106250
* Author: tompng (tomoya ishida)
* Status: Open
* Priority: Normal
* ruby -v: ruby 3.4.0dev (2024-01-09T07:07:19Z master db476cc71c) [x86_64-linux]
* Backport: 3.0: DONTNEED, 3.1: DONTNEED, 3.2: REQUIRED, 3.3: REQUIRED
----------------------------------------
Expanding string in some encoding (utf16 utf32) can change coderange to either valid or broken, but rb_str_resize does not clear coderange.
This will cause a bug in c-extension libraries that use rb_str_resize.
~~~ruby
# Example for stringio
s = StringIO.new("\0".encode('UTF-16LE'))
s.truncate(1); s.truncate(2); s.string.valid_encoding?
#=> true
s.truncate(1); s.string.valid_encoding?; s.truncate(2); s.string.valid_encoding?
#=> false (expect to be true)
~~~
--
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/postorius/lists/ruby-core.ml.ruby-lang.org/