diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-07-11 01:09:05 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-07-11 01:09:05 +0000 |
commit | 8a608d2b1f6f0f6422d456255f85bf436fa036e5 (patch) | |
tree | 166cd2faebf8fc9582e143ded775a9cba004fe9c /test/ruby | |
parent | 70451a56edfac7cb226a5401f05cad0fab4c2f7c (diff) | |
download | ruby-8a608d2b1f6f0f6422d456255f85bf436fa036e5.tar.gz |
pack.c: fix buffer overrun
* pack.c (encodes): fix buffer overrun by tail_lf. Thanks to
Mamoru Tasaka and Tomas Hoger. [ruby-core:63604] [Bug #10019]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46778 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby')
-rw-r--r-- | test/ruby/test_pack.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/test/ruby/test_pack.rb b/test/ruby/test_pack.rb index 38c1981a44..64d1e68245 100644 --- a/test/ruby/test_pack.rb +++ b/test/ruby/test_pack.rb @@ -550,6 +550,14 @@ EXPECTED assert_equal(["\0"], "AA\n".unpack("m")) assert_equal(["\0"], "AA=\n".unpack("m")) assert_equal(["\0\0"], "AAA\n".unpack("m")) + + bug10019 = '[ruby-core:63604] [Bug #10019]' + size = ((4096-4)/4*3+1) + assert_separately(%W[- #{size} #{bug10019}], <<-'end;') + size = ARGV.shift.to_i + bug = ARGV.shift + assert_equal(size, ["a"*size].pack("m#{size+2}").unpack("m")[0].size, bug) + end; end def test_pack_unpack_m0 |