From c880452b7cdb1132a86974f621deb49388aad1fb Mon Sep 17 00:00:00 2001 From: usa Date: Fri, 30 Sep 2016 15:03:15 +0000 Subject: merge revision(s) 55822: [Backport #12660] * ext/openssl/ossl_ssl.c (ossl_ssl_write_internal): avoid undefined behavior * test/openssl/test_pair.rb (test_write_zero): new test [ruby-core:76751] [Bug #12660] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_2@56300 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/openssl/test_pair.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'test') diff --git a/test/openssl/test_pair.rb b/test/openssl/test_pair.rb index 3aca5f4833..ea5b917d7f 100644 --- a/test/openssl/test_pair.rb +++ b/test/openssl/test_pair.rb @@ -271,6 +271,17 @@ module OpenSSL::TestPairM } end + def test_write_zero + ssl_pair {|s1, s2| + assert_equal 0, s2.write_nonblock('', exception: false) + assert_kind_of Symbol, s1.read_nonblock(1, exception: false) + assert_equal 0, s2.syswrite('') + assert_kind_of Symbol, s1.read_nonblock(1, exception: false) + assert_equal 0, s2.write('') + assert_kind_of Symbol, s1.read_nonblock(1, exception: false) + } + end + def tcp_pair host = "127.0.0.1" serv = TCPServer.new(host, 0) -- cgit v1.2.3