From 52069c58c9b5bd5386fb754264f18038bfdfa75d Mon Sep 17 00:00:00 2001 From: glass Date: Sun, 10 May 2015 02:49:01 +0000 Subject: * string.c (rb_str_crypt): Raise ArgumentError when string passed to String#crypt contains null. the patch is from jrusnack . [Bug #10988] [fix GH-853] * test/ruby/test_string.rb: test for above. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50458 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_string.rb | 1 + 1 file changed, 1 insertion(+) (limited to 'test/ruby/test_string.rb') diff --git a/test/ruby/test_string.rb b/test/ruby/test_string.rb index 4cd6afdd80..2768a65441 100644 --- a/test/ruby/test_string.rb +++ b/test/ruby/test_string.rb @@ -507,6 +507,7 @@ class TestString < Test::Unit::TestCase assert_raise(ArgumentError) {S("mypassword").crypt(S(""))} assert_raise(ArgumentError) {S("mypassword").crypt(S("\0a"))} assert_raise(ArgumentError) {S("mypassword").crypt(S("a\0"))} + assert_raise(ArgumentError) {S("poison\u0000null").crypt(S("aa"))} [Encoding::UTF_16BE, Encoding::UTF_16LE, Encoding::UTF_32BE, Encoding::UTF_32LE].each do |enc| assert_raise(ArgumentError) {S("mypassword").crypt(S("aa".encode(enc)))} -- cgit v1.2.3