summaryrefslogtreecommitdiff
path: root/ext
AgeCommit message (Collapse)Author
2024-12-23use `st_update` to prevent table extensionKoichi Sasada
to prevent the following scenario: 1. `delete_unique_str()` can be called while GC (sweeping) 2. it calls `st_insert()` to decrement the counter 3. `st_insert()` can try to extend the table even if the key exists 4. `xmalloc` while GC and cause BUG Notes: Merged: https://github.com/ruby/ruby/pull/12407
2024-12-22[ruby/openssl] Ruby/OpenSSL 3.3.0Kazuki Yamaguchi
https://github.com/ruby/openssl/commit/e5153dbbb4 Notes: Merged: https://github.com/ruby/ruby/pull/12421
2024-12-22[ruby/openssl] digest: remove optional parameter from OpenSSL::Digest#finishKazuki Yamaguchi
OpenSSL::Digest#finish overrides Digest::Instance#finish and is called from the Digest::Class framework in the digest library. This method is not supposed to take any arguments, as suggested by the RDoc comment for Digest::Instance#finish. It is a private method and not exposed to users. Let's remove it. This optional parameter exists since r15602 in Ruby trunk, the commit which converted OpenSSL::Digest to a subclass of Digest::Class. https://github.com/ruby/openssl/commit/dcb2a4f30b Notes: Merged: https://github.com/ruby/ruby/pull/12421
2024-12-22[ruby/openssl] digest: make output buffer String independent in #finishKazuki Yamaguchi
Likewise, OpenSSL::Digest#finish needs to make the output buffer independent before writing to it. https://github.com/ruby/openssl/commit/9cc8a83466 Notes: Merged: https://github.com/ruby/ruby/pull/12421
2024-12-22[ruby/openssl] cipher: make output buffer String independentKazuki Yamaguchi
OpenSSL::Cipher#update accepts a String as the second argument to be used as the output buffer. The buffer must be directly writable, in other words, it must not be frozen and not a shared string. rb_str_resize() does not make the String independent if the String already has the intended length. Use the rb_str_modify() family instead to check it. Fixes: https://bugs.ruby-lang.org/issues/20937 https://github.com/ruby/openssl/commit/1de3b80a46 Notes: Merged: https://github.com/ruby/ruby/pull/12421
2024-12-22[ruby/openssl] pkcs12: add PKCS12#set_macKazuki Yamaguchi
Add a binding for PKCS12_set_mac() to set MAC parameters and (re-)calculate MAC for the content. This allows generating PKCS #12 with consistent MAC parameters with different OpenSSL versions. OpenSSL 3.0 changed the default hash function used for HMAC and the KDF from SHA-1 to SHA-256. Fixes: https://github.com/ruby/openssl/issues/772 https://github.com/ruby/openssl/commit/f5ed2a74b6 Notes: Merged: https://github.com/ruby/ruby/pull/12421
2024-12-19Prefix asan_poison_object with rbPeter Zhu
Notes: Merged: https://github.com/ruby/ruby/pull/12385
2024-12-19[ruby/json] Release 2.9.1Jean Boussier
https://github.com/ruby/json/commit/f745ec145e Notes: Merged: https://github.com/ruby/ruby/pull/12394
2024-12-19[ruby/json] Add support for Solaris 10 which lacks strnlen()Naohisa Goto
Check for existence of strnlen() and use alternative code if it is missing. https://github.com/ruby/json/commit/48d4bbc3a0 Notes: Merged: https://github.com/ruby/ruby/pull/12394
2024-12-18[ruby/psych] Bump up v5.2.2Hiroshi SHIBATA
https://github.com/ruby/psych/commit/746e1ad24d
2024-12-18Wrap `do_fast_fallback_getaddrinfo` with `rb_thread_prevent_fork` (#12366)Misaki Shioi
Wrap `do_fast_fallback_getaddrinfo` with `rb_thread_prevent_fork` Referencing PR #10864, wrap `do_fast_fallback_getaddrinfo` with `rb_thread_prevent_fork` to avoid fork safety issues. `do_fast_fallback_getaddrinfo` internally uses getaddrinfo(3), leading to fork safety issues, as described in PR #10864. This change ensures that `do_fast_fallback_getaddrinfo` is guarded by `rb_thread_prevent_fork`, preventing fork during its execution and avoiding related issues. Notes: Merged-By: shioimm <shioi.mm@gmail.com>
2024-12-17[ruby/win32ole] Bump up v1.9.1Hiroshi SHIBATA
https://github.com/ruby/win32ole/commit/3e9b3b02e9
2024-12-16Check whether object is valid in allocation_info_tracer_compactPeter Zhu
When reference updating ObjectSpace.trace_object_allocations, we need to check whether the object is valid or not because it does not mark the object so the object may be dead. This can cause a segmentation fault if the object is on a free heap page. For example, the following script crashes: require "objspace" objs = [] ObjectSpace.trace_object_allocations do 1_000_000.times do objs << Object.new end end objs = nil # Free pages that the objs were on GC.start # Run compaction and check that it doesn't crash GC.compact Notes: Merged: https://github.com/ruby/ruby/pull/12360
2024-12-16Fix ObjectSpace.trace_object_allocations for compactionPeter Zhu
We need to reinsert into the ST table when an object moves because it is a numtable that hashes on the object address, so when an object moves we need to reinsert it rather than just updating the key. Notes: Merged: https://github.com/ruby/ruby/pull/12339
2024-12-16Fix compaction check for ObjectSpace.trace_object_allocationsPeter Zhu
We should be checking for key for moved objects rather than the value because the key is a Ruby object and the value is malloc'd memory. Notes: Merged: https://github.com/ruby/ruby/pull/12339
2024-12-16[ruby/psych] Don't autolink Exception in psych module docszzak
https://docs.ruby-lang.org/en/master/Psych.html#module-Psych-label-Exception+handling https://github.com/ruby/psych/commit/c53c298222
2024-12-16[ruby/digest] Bump up v3.2.0Hiroshi SHIBATA
https://github.com/ruby/digest/commit/26c757fe9a
2024-12-16Lock released version of fiddle-1.1.6Hiroshi SHIBATA
2024-12-16[ruby/fiddle] ffi_backend: convert numeric function args to pointersDani Smith
(https://github.com/ruby/fiddle/pull/162) This allows for passing integers as pointer arguments to functions when using the FFI backend. This is a workaround until we can get JRuby's FFI implementation to allow for it directly (see also https://github.com/jruby/jruby/pull/8423) --------- https://github.com/ruby/fiddle/commit/e2f0952e9b Co-authored-by: Benoit Daloze <eregontp@gmail.com>
2024-12-16[ruby/strscan] [DOC] Add syntax highlighting to MarkDown code blocksAlexander Momchilov
(https://github.com/ruby/strscan/pull/126) Split off from https://github.com/ruby/ruby/pull/12322 https://github.com/ruby/strscan/commit/9bee37e0f5
2024-12-16[ruby/strscan] Bump versionSutou Kouhei
https://github.com/ruby/strscan/commit/fd140b8582
2024-12-16[DOC] Fix broken parameter display and see links for Socketnvh0412
Notes: Merged: https://github.com/ruby/ruby/pull/12350
2024-12-15Fix broken links to `Socket.tcp_fast_fallback=`Stan Lo
Since it's a singleton method, it should be referenced as `Socket.tcp_fast_fallback=`, not `Socket#tcp_fast_fallback=`. Notes: Merged: https://github.com/ruby/ruby/pull/12348
2024-12-15[ruby/date] Fix broken rdoc-ref to the calendar pageStan Lo
https://github.com/ruby/date/commit/cb52e64be1
2024-12-14Improve APIs for Globally Enabling/Disabling fast_fallback in Socket (#12257)Misaki Shioi
This change includes the following updates: - Added an environment variable `RUBY_TCP_NO_FAST_FALLBACK` to control enabling/disabling fast_fallback - Updated documentation and man pages - Revised the implementation of Socket.tcp_fast_fallback= and Socket.tcp_fast_fallback, which previously performed dynamic name resolution of constants and variables. As a result, the following performance improvements were achieved: (Case of 1000 executions of `TCPSocket.new` to the local host) Rehearsal ----------------------------------------- before 0.031462 0.147946 0.179408 ( 0.249279) after 0.031164 0.146839 0.178003 ( 0.346935) -------------------------------- total: 0.178003sec user system total real before 0.027584 0.138712 0.166296 ( 0.233356) after 0.025953 0.127608 0.153561 ( 0.237971) Notes: Merged-By: shioimm <shioi.mm@gmail.com>
2024-12-13Lock released version of stringio-3.1.2Hiroshi SHIBATA
2024-12-13[ruby/zlib] Bump up v3.2.1Hiroshi SHIBATA
https://github.com/ruby/zlib/commit/d2e29b23c8
2024-12-12[ruby/win32ole] Deprecate old constants in toplevelNobuyoshi Nakada
https://github.com/ruby/win32ole/commit/eaa1507262
2024-12-12[ruby/win32ole] [DOC] Hide old constants for the backward compatibility from ↵Nobuyoshi Nakada
RDoc https://github.com/ruby/win32ole/commit/99e1ea403f
2024-12-12[ruby/win32ole] [DOC] Fix a markup for codeNobuyoshi Nakada
https://github.com/ruby/win32ole/commit/542d39372c
2024-12-12Lock released version of strscan-3.1.1Hiroshi SHIBATA
2024-12-11Use ruby_strdup/xfree in fast_fallbackJohn Hawthorn
Any memory allocated with xmalloc needs to be matched with xfree rather than plain free. Ruby unfortunately redefines strdup to be ruby_strdup, which uses xmalloc so needs to be xfreed. Previously these were mismatched. This commit changes the copy to be an explicit ruby_strdup (to avoid confusion) and the free to be xfree. Notes: Merged: https://github.com/ruby/ruby/pull/12311
2024-12-11Use `rb_thread_fd_select` instead of select(2) (#12292)Misaki Shioi
* Use `rb_thread_fd_select` instead of select(2) For fixing https://bugs.ruby-lang.org/issues/20932 . `TCPSocket.new`, which internally uses select(2) for HEv2, can cause SEGV if the number of file descriptors exceeds `FD_SETSIZE`. This change avoids that issue by replacing select(2) with `rb_thread_fd_select`, which is provided as part of Ruby's internal API. --- This includes the following changes. * rb_thread_fd_select does not need common pipe Notes: Merged-By: shioimm <shioi.mm@gmail.com>
2024-12-11[ruby/digest] Bump up v3.2.0.pre0, preparing to stable releaseHiroshi SHIBATA
https://github.com/ruby/digest/commit/d19c84fd68
2024-12-11[ruby/fiddle] dlopen: add support for INPUT(-lXXX)Sutou Kouhei
GitHub: fix https://github.com/ruby/fiddle/pull/166 Arch Linux's libncurses.so uses this style. https://github.com/ruby/fiddle/commit/77d3dc934f
2024-12-11[ruby/fiddle] Implement `Fiddle::Pointer.read` and `.write` on theLars Kanis
FFI backend (https://github.com/ruby/fiddle/pull/165) https://github.com/ruby/fiddle/commit/0bd963d3b8
2024-12-10[ruby/resolv] Build the extension library only when CRuby (FixNobuyoshi Nakada
https://github.com/ruby/resolv/pull/69) On JRuby no C compiler is available and this call results in a runtime error. https://github.com/ruby/resolv/commit/33105bc504
2024-12-09objspace_dump: Use FILE* to avoid crashing in mark functionsAlan Wu
We observed crashes from rb_io_bufwrite() thread switching (through rb_thread_check_ints()) in the middle of rb_execution_context_mark(). By the time rb_execution_context_mark() gets a timeslice again, it read garbage from a frame that was already popped in another thread, crashing the process in SEGV. Other mark functions probably have their own ways of breaking, but clearly, the usual IO code do too much for this perilous pseudo GC context. Use `FILE*` like before 5001cc47169614ea07d87651c95c2ee185e374e0 ("Optimize ObjectSpace.dump_all"). Also, add type checking for the private _dump methods. Co-authored-by: Peter Zhu <peter@peterzhu.ca> Notes: Merged: https://github.com/ruby/ruby/pull/12285
2024-12-10Fix Connection Attempt Delay of `Socket.tcp` (#12291)Misaki Shioi
The following two commits fix the proper clearing of the Connection Attempt Delay in `TCPSocket.new`. - https://github.com/ruby/ruby/pull/12087/commits/b2f610b0edf8f84d9d0fce038f3ebfa9f2cb0223 - https://github.com/ruby/ruby/pull/12223/commits/6f4efaec5352cdeb6cab86036a83f53c9fa5c3d2 The same fix will be applied to `Socket.tcp`. Notes: Merged-By: shioimm <shioi.mm@gmail.com>
2024-12-09[ruby/etc] Bump up 1.4.5Hiroshi SHIBATA
https://github.com/ruby/etc/commit/5019f4314a
2024-12-09[ruby/psych] Bump up 5.2.1Hiroshi SHIBATA
https://github.com/ruby/psych/commit/7c81f7db53
2024-12-07[ruby/openssl] ssl: do not clear existing SSL options in SSLContext#set_paramsKazuki Yamaguchi
Apply SSL options set in DEFAULT_PARAMS without clearing existing options. It currently clears options in order to avoid setting one of the options included in OpenSSL::SSL::OP_ALL unless explicitly specified, namely OpenSSL::SSL::OP_DONT_INSERT_EMPTY_FRAGMENTS. Now that OpenSSL::SSL::OP_ALL has been removed from SSLContext#initialize, it is no longer necessary. https://github.com/ruby/openssl/commit/77c3db2d65
2024-12-07[ruby/openssl] ssl: do not enable OpenSSL::SSL::OP_ALL by defaultKazuki Yamaguchi
Respect the SSL options set by default by SSL_CTX() and by the system-wide OpenSSL configuration file. OpenSSL::SSL::SSLContext#initialize currently adds OpenSSL::SSL::OP_ALL on top of the default SSL options. Let's stop doing it. OpenSSL::SSL::OP_ALL is a set of options that changes OpenSSL's behavior to workaround various TLS implementation bugs. Using it is considered usually safe, but is not completely harmless. https://github.com/ruby/openssl/commit/00bec0d905
2024-12-07[ruby/openssl] ssl: improve documentation of SSLContext#options=Kazuki Yamaguchi
https://github.com/ruby/openssl/commit/9120fcde6a
2024-12-07[ruby/openssl] Call Init_ossl_*() functions in alphabetical orderKazuki Yamaguchi
It was originally sorted in alphabetical order, but it has been broken over time. Let's fix it. https://github.com/ruby/openssl/commit/974c67f38f
2024-12-07[ruby/openssl] Mark variables and functions as static whenever possibleKazuki Yamaguchi
https://github.com/ruby/openssl/commit/85d6b7f192
2024-12-07[ruby/openssl] ts: fix exception class raised when getting an OID nameKazuki Yamaguchi
get_asn1obj() is used by several methods in OpenSSL::Timestamp to get the string representation of an OID. On an error, such as memory allocation failure, it can raise OpenSSL::X509::AttributeError. It should be OpenSSL::Timestamp::TimestampError instead. https://github.com/ruby/openssl/commit/a424aad1df
2024-12-07[ruby/openssl] ts: avoid using OpenSSL::PKCS7's internalsKazuki Yamaguchi
Internals of OpenSSL::PKCS7 should be kept within ossl_pkcs7.c. Add a new ossl_pkcs7_new() function for duplicating and wrapping an OpenSSL PKCS7 object in OpenSSL::PKCS7. This follows the convention used by other ossl_*_new() functions. https://github.com/ruby/openssl/commit/b5f79f771e
2024-12-07[ruby/openssl] x509store: fix exception class in ↵Kazuki Yamaguchi
OpenSSL::X509::StoreContext#verify Follow-up commit https://github.com/ruby/openssl/commit/0789643d7333 (openssl: clear OpenSSL error queue before return to Ruby, 2016-05-18). It should raise OpenSSL::X509::StoreError instead of OpenSSL::X509::CertificateError. https://github.com/ruby/openssl/commit/0201f23ad6
2024-12-07[ruby/openssl] ns_spki: fix exception class in OpenSSL::Netscape::SPKI#to_derKazuki Yamaguchi
It should raise OpenSSL::Netscape::SPKIError instead of OpenSSL::X509::CertificateError. No test cases covered this because it only occurs in exceptional cases, such as memory allocation failure. https://github.com/ruby/openssl/commit/527b6101d1