Commit graph

8776 commits

Author SHA1 Message Date
Jean Boussier
fa674cf723 [ruby/date] Date._<format>(nil) should return an empty Hash
Fix: https://github.com/ruby/date/issues/39

This is how versions previous to 3.2.1 behaved and Active Support
currently rely on this behavior.

90357af080/activesupport/lib/active_support/values/time_zone.rb (L383-L384)

Any Rails application upgrading to date `3.2.1` might run into unexpected errors.

8f2d7a0c7e
2021-11-16 22:51:40 +09:00
Nobuyoshi Nakada
27168a1cf7 [ruby/nkf] Fix a typo [ci skip]
18c118c83c
2021-11-16 21:07:19 +09:00
Yusuke Endoh
489c8cebf5 [ruby/date] Add length limit option for methods that parses date strings
`Date.parse` now raises an ArgumentError when a given date string is
longer than 128. You can configure the limit by giving `limit` keyword
arguments like `Date.parse(str, limit: 1000)`. If you pass `limit: nil`,
the limit is disabled.

Not only `Date.parse` but also the following methods are changed.

* Date._parse
* Date.parse
* DateTime.parse
* Date._iso8601
* Date.iso8601
* DateTime.iso8601
* Date._rfc3339
* Date.rfc3339
* DateTime.rfc3339
* Date._xmlschema
* Date.xmlschema
* DateTime.xmlschema
* Date._rfc2822
* Date.rfc2822
* DateTime.rfc2822
* Date._rfc822
* Date.rfc822
* DateTime.rfc822
* Date._jisx0301
* Date.jisx0301
* DateTime.jisx0301

3959accef8
2021-11-16 20:56:56 +09:00
Nobuyoshi Nakada
c910de3575 [ruby/io-wait] Fix dependency for ruby 2.6
2eb3841e9c
2021-11-16 20:25:47 +09:00
Nobuyoshi Nakada
96d9cfba08 [ruby/io-wait] Allow earlier versions
1060f9348c
2021-11-16 20:25:46 +09:00
Nobuyoshi Nakada
db71a04c2e [ruby/io-wait] Fix backward compatibility with earlier versions
898248931f
2021-11-16 20:25:43 +09:00
Hiroshi SHIBATA
018266ca38
Merge digest-3.0.3.pre3 and efd76821b8 2021-11-16 19:42:20 +09:00
Akinori MUSHA
625cffc808 [ruby/digest] Abort loading if being loaded by gem/bundle pre Ruby 3.0.3
efd76821b8
2021-11-16 18:35:13 +09:00
xtkoba
fed65e6a48 [ruby/digest] Avoid null pointer subtraction in digest/md5
Fixes warning on Clang 13.

Fixes [Bug #18076]

32135c7487
2021-11-16 18:35:07 +09:00
Peter Zhu
aeae6e2842 [Feature #18290] Remove all usages of rb_gc_force_recycle
This commit removes usages of rb_gc_force_recycle since it is a burden
to maintain and makes changes to the GC difficult.
2021-11-08 14:05:54 -05:00
Nobuyoshi Nakada
2772f85648
Prefer ANSI-style prototypes over old K&R-style definitions 2021-11-08 17:08:01 +09:00
Nobuyoshi Nakada
b47f7afbc3
Fix filename typo [Bug #18140] 2021-11-08 17:08:01 +09:00
Nobuyoshi Nakada
5b8d22ebe6 [ruby/openssl] Fix typos [ci skip]
708ebf2f7a
2021-11-03 23:43:04 +09:00
Yusuke Endoh
8413749ec0 ext/socket/extconf.rb: Fix the chech if if_indextoname is available
The check had not work because "headers" were not passed.
2021-11-02 23:41:01 +09:00
Nobuyoshi Nakada
a202408180
Fix typos 2021-11-02 19:17:37 +09:00
Kazuki Yamaguchi
b474049c78 [ruby/openssl] x509name: improve docs for X509::Name
Add docs for X509::Name.parse_openssl and X509::Name.parse_rfc2253,
which are currently undocumented despite being widely used.

Small changes are also made to #to_s and the class description to
recommend using RFC 2253-based methods.

Fixes: https://github.com/ruby/openssl/issues/470

74041a35d4
2021-11-01 17:48:03 +09:00
Kazuki Yamaguchi
1ac7f23bb8 [ruby/openssl] ssl: disallow reading/writing to unstarted SSL socket
OpenSSL::SSL::SSLSocket allowed #read and #write to be called before an
SSL/TLS handshake is completed. They passed unencrypted data to the
underlying socket.

This behavior is very odd to have in this library. A verbose mode
warning "SSL session is not started yet" was emitted whenever this
happened. It also didn't behave well with OpenSSL::Buffering. Let's
just get rid of it.

Fixes: https://github.com/ruby/openssl/issues/9

bf780748b3
2021-11-01 17:48:02 +09:00
Peter Zhu
a5b6598192 [Feature #18239] Implement VWA for strings
This commit adds support for embedded strings with variable capacity and
uses Variable Width Allocation to allocate strings.
2021-10-25 13:26:23 -04:00
Yusuke Endoh
86e3d77abb
Make Coverage suspendable (#4856)
* Make Coverage suspendable

Add `Coverage.suspend`, `Coverage.resume` and some methods.

[Feature #18176] [ruby-core:105321]
2021-10-25 20:00:51 +09:00
Kazuki Yamaguchi
e10dfdf623 [ruby/openssl] bn: expand BIGNUM_RAND and BIGNUM_RAND_RANGE macros
Now that BN.pseudo_rand{,_range} are alias, those macros are only used
once. Let's expand the macros for better readability.

7c2fc00dee
2021-10-25 00:40:48 +09:00
Kazuki Yamaguchi
e19186707a [ruby/openssl] bn: make BN.pseudo_rand{,_range} an alias of BN.rand{,_range}
BN_pseudo_rand() and BN_pseudo_rand_range() are deprecated in
OpenSSL 3.0. Since they are identical to their non-'pseudo' version
anyway, let's make them alias.

2d34e85ddf
2021-10-25 00:40:48 +09:00
Kazuki Yamaguchi
1b5ccc8a0c [ruby/openssl] pkey, ssl: use EVP_PKEY_eq() instead of EVP_PKEY_cmp()
OpenSSL 3.0 renamed EVP_PKEY_cmp() to EVP_PKEY_eq() because that was a
confusing name.

d42bd7fcdb
2021-10-25 00:40:47 +09:00
Kazuki Yamaguchi
ee7131614c [ruby/openssl] pkey/ec: use EC_GROUP_free() instead of EC_GROUP_clear_free()
EC_GROUP_clear_free() is deprecated in OpenSSL 3.0.

EC_GROUP does not include any sensitive data, so we can safely use
EC_GROUP_free() instead.

e93a5fdffc
2021-10-25 00:40:47 +09:00
Kazuki Yamaguchi
555788b622 [ruby/openssl] pkey/ec: deprecate PKey::EC::Point#make_affine! and make it a no-op
It converts the internal representation of the point object to the
affine coordinate system. However, it had no real use case because the
difference in the internal representation has not been visible from
Ruby/OpenSSL at all.

EC_POINT_make_affine() is marked as deprecated in OpenSSL 3.0.

e2cc81fef7
2021-10-25 00:40:46 +09:00
Kazuki Yamaguchi
16272d9ae9 [ruby/openssl] hmac: use EVP_MD_CTX_get_pkey_ctx() instead of EVP_MD_CTX_pkey_ctx()
OpenSSL 3.0 renamed EVP_MD_CTX_pkey_ctx() to include "get" in the
function name. Adjust compatibility macro so that we can use the new
function name for all OpenSSL 1.0.2-3.0.

c106d888c6
2021-10-25 00:40:46 +09:00
Kazuki Yamaguchi
040387d265 [ruby/openssl] digest: use EVP_MD_CTX_get0_md() instead of EVP_MD_CTX_md() if exists
The function was renamed in OpenSSL 3.0 due to the change of the
lifetime of EVP_MD objects. They are no longer necessarily statically
allocated and can be reference-counted -- when an EVP_MD_CTX is free'd,
the associated EVP_MD can also become inaccessible.

Currently Ruby/OpenSSL only handles builtin algorithms, so no special
handling is needed except for adapting to the rename.

0a253027e6
2021-10-25 00:40:45 +09:00
Kazuki Yamaguchi
cfa4fa636e [ruby/openssl] bn: use BN_check_prime() in OpenSSL::BN#prime{,_fasttest}?
In OpenSSL 3.0, BN_is_prime_ex() and BN_is_prime_fasttest_ex() are
deprecated in favor of BN_check_prime().

90d51ef510
2021-10-25 00:40:45 +09:00
Kazuki Yamaguchi
fa24e7a57e [ruby/openssl] ssl: use SSL_get_rbio() to check if SSL is started or not
Use SSL_get_rbio() instead of SSL_get_fd(). SSL_get_fd() internally
calls SSL_get_rbio() and it's enough for our purpose.

In OpenSSL 3.0, SSL_get_fd() leaves an entry in the OpenSSL error queue
if BIO has not been set up yet, and we would have to clean it up.

e95ee24867
2021-10-25 00:40:44 +09:00
Kazuki Yamaguchi
d5aa3fcae6 [ruby/openssl] ssl: use SSL_CTX_load_verify_{file,dir}() if available
SSL_CTX_load_verify_locations() is deprecated in OpenSSL 3.0 and
replaced with those two separate functions. Use them if they exist.

5375a55ffc
2021-10-25 00:40:44 +09:00
Kazuki Yamaguchi
19ef7082ba [ruby/openssl] ts: use TS_VERIFY_CTX_set_certs instead of TS_VERIFY_CTS_set_certs
OpenSSL 3.0 fixed the typo in the function name and replaced the
current 'CTS' version with a macro.

2be6779b08
2021-10-25 00:40:43 +09:00
Kazuki Yamaguchi
3d16401508 [ruby/openssl] ossl.c: use ERR_get_error_all() if available
OpenSSL 3.0 deprecated ERR_get_error_line_data() in favor of
ERR_get_error_all(), as part of the error queue structure changes.

8e98d2ecc8
2021-10-25 00:40:43 +09:00
Kazuki Yamaguchi
32d49e93cf [ruby/openssl] ext/openssl/ossl.h: add helper macros for OpenSSL/LibreSSL versions
Add following convenient macros:

 - OSSL_IS_LIBRESSL
 - OSSL_OPENSSL_PREREQ(maj, min, pat)
 - OSSL_LIBRESSL_PREREQ(maj, min, pat)

00abee791d
2021-10-25 00:40:42 +09:00
Hiroshi SHIBATA
1be2875e1d
[flori/json] Bump version to v2.6.1
2db5894cfa
2021-10-24 09:25:20 +09:00
Josef Šimánek
4cbce79438
[flori/json] Bump JSON::VERSION to 2.6.0.
da94d9f059
2021-10-24 09:25:01 +09:00
David Rodríguez
d04d6bbc6c [ruby/psych] Prefer require_relative for internal requires
a0f55ee85a
2021-10-24 08:49:14 +09:00
Josef Šimánek
48cd633094 [ruby/psych] Add stringio as a dependency.
86e3049579
2021-10-24 08:48:40 +09:00
Sutou Kouhei
c0c43276a1 [ruby/strscan] Bump version
If we use the same version as the default strscan gem in Ruby, "gem
install" doesn't extract .gem. It fails "gem install" because "gem
install" can't find ext/strscan/ to be built.

3ceafa6cdc
2021-10-24 05:57:48 +09:00
Aaron Patterson
35b9d8d393 [ruby/openssl] Raise an exception if the IO object passed to SSLSocket isn't a file
SSLSocket#connect eventually calls `GetOpenFile` in order to get the
underlying file descriptor for the IO object passed in on
initialization.  `GetOpenFile` assumes that the Ruby object passed in is
a T_FILE object and just casts it to a T_FILE without any checks.  If
you pass an object that *isn't* a T_FILE to that function, the program
will segv.

Since we assume the IO object is a file in the `connect` method, this
commit adds a `CheckType` in the initialize method to ensure that the IO
object is actually a T_FILE.  If the object *isn't* a T_FILE, this class
will segv on `connect`, so I think this is a backwards compatible
change.

919fa44ec2
2021-10-23 13:38:40 +09:00
Hiroshi SHIBATA
93691d0752
Import bigdecimal-3.1.0.dev 2021-10-22 15:53:49 +09:00
Hiroshi SHIBATA
c5345979e8
Bump up readline-ext version to 0.1.3 2021-10-21 21:17:45 +09:00
Hiroshi SHIBATA
7529fe82f0 [ruby/io-wait] Bump up io-wait version to 0.2.0
f6a1b10a59
2021-10-21 20:54:20 +09:00
Hiroshi SHIBATA
8eb8522f47 [ruby/stringio] Bump up stringio version to 3.0.1
f7c40aa339
2021-10-21 20:53:53 +09:00
Hiroshi SHIBATA
5823168706 [ruby/psych] Bump up psych version to 4.0.2
69a713f860
2021-10-21 13:49:20 +09:00
Alan Wu
c02517bacb Tie lifetime of uJIT blocks to iseqs
* Tie lifetime of uJIT blocks to iseqs

   Blocks weren't being freed when iseqs are collected.

* Add rb_dary. Use it for method dependency table

* Keep track of blocks per iseq

  Remove global version_tbl

* Block version bookkeeping fix

* dary -> darray

* free ujit_blocks

* comment about size of ujit_blocks
2021-10-20 18:19:29 -04:00
Hiroshi SHIBATA
847eeafd65 [ruby/etc] Bump up etc version to 1.3.0
85ca541d0b
2021-10-19 20:55:33 +09:00
Hiroshi SHIBATA
b482a516d2 [ruby/zlib] Bump up zlib version to 2.1.1
82e9a636a6
2021-10-19 20:28:57 +09:00
Nobuyoshi Nakada
ae25313e80
[ruby/etc] Remove unnecessary declaration
Fix https://github.com/ruby/etc/pull/12

7cbf03d22d
2021-10-19 17:25:40 +09:00
Kazuki Yamaguchi
cc8ff8b50d [ruby/openssl] require Ruby 2.6 or later
Drop support for Ruby 2.3, 2.4, and 2.5.

As of 2021-10, Ruby 2.6 is the oldest version that still receives
security fixes from the Ruby core team, so it doesn't make much sense
to keep code for those ancient versions.

3436bd040d
2021-10-16 19:39:13 +09:00
Kazuki Yamaguchi
4991dabdd0 [ruby/openssl] bump version number to 3.0.0.pre
baa83a8a57
2021-10-16 18:57:57 +09:00
Kazuki Yamaguchi
cea3c55d58 [ruby/openssl] Ruby/OpenSSL 2.2.1
65e7207a07
2021-10-16 18:34:35 +09:00