[ruby-cvs:62987] normal:r55822 (trunk): openssl: avoid undefined behavior on empty SSL_write

normal at ruby-lang.org normal at ruby-lang.org
Sun Aug 7 06:50:10 JST 2016

normal	2016-08-07 06:50:10 +0900 (Sun, 07 Aug 2016)

  New Revision: 55822


    openssl: avoid undefined behavior on empty SSL_write
    SSL_write(3ssl) manpage has this in the WARNINGS section:
           When calling SSL_write() with num=0 bytes to be sent the
           behaviour is undefined.
    And indeed, the new test case demonstrates failures when
    empty strings are used.  So, match the behavior of IO#write,
    IO#write_nonblock, and IO#syswrite by returning zero, as the
    OpenSSL::SSL::SSLSocket API already closely mimics the IO one.
    * 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]

  Modified files:

More information about the ruby-cvs mailing list