mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
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_3@55961 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
6d37aaab9a
commit
a9e98cf7d4
4 changed files with 26 additions and 2 deletions
|
@ -1,3 +1,10 @@
|
|||
Thu Aug 18 23:43:33 2016 Eric Wong <e@80x24.org>
|
||||
|
||||
* 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]
|
||||
|
||||
Thu Aug 18 23:18:17 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* ext/socket/option.c, ext/socket/rubysocket.h (inet_ntop): share
|
||||
|
|
|
@ -1533,7 +1533,13 @@ ossl_ssl_write_internal(VALUE self, VALUE str, VALUE opts)
|
|||
|
||||
if (ssl) {
|
||||
for (;;){
|
||||
nwrite = SSL_write(ssl, RSTRING_PTR(str), RSTRING_LENINT(str));
|
||||
int num = RSTRING_LENINT(str);
|
||||
|
||||
/* SSL_write(3ssl) manpage states num == 0 is undefined */
|
||||
if (num == 0)
|
||||
goto end;
|
||||
|
||||
nwrite = SSL_write(ssl, RSTRING_PTR(str), num);
|
||||
switch(ssl_get_error(ssl, nwrite)){
|
||||
case SSL_ERROR_NONE:
|
||||
goto end;
|
||||
|
|
|
@ -280,6 +280,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)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#define RUBY_VERSION "2.3.2"
|
||||
#define RUBY_RELEASE_DATE "2016-08-18"
|
||||
#define RUBY_PATCHLEVEL 172
|
||||
#define RUBY_PATCHLEVEL 173
|
||||
|
||||
#define RUBY_RELEASE_YEAR 2016
|
||||
#define RUBY_RELEASE_MONTH 8
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue