mirror of
https://github.com/ruby/ruby.git
synced 2025-09-22 03:53:58 +02:00
string.c: enable capacity when setting capa
* string.c (rb_str_modify_expand): enable capacity and disable assocation with packed objects when setting capa, so that pack("p") string fails to unpack properly after modified. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44803 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
5b92c0bea3
commit
bebc52a4a7
3 changed files with 8 additions and 0 deletions
|
@ -181,6 +181,7 @@ class TestPack < Test::Unit::TestCase
|
|||
assert_equal a[0], a.pack("p").unpack("p")[0]
|
||||
assert_equal a, a.pack("p").freeze.unpack("p*")
|
||||
assert_raise(ArgumentError) { (a.pack("p") + "").unpack("p*") }
|
||||
assert_raise(ArgumentError) { (a.pack("p") << "d").unpack("p*") }
|
||||
end
|
||||
|
||||
def test_format_string_modified
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue