From b9cd110ec08dfb0c1f87b50a85950bdf4fda5599 Mon Sep 17 00:00:00 2001 From: Stan Hu Date: Wed, 8 May 2024 00:14:36 -0700 Subject: [PATCH] Update to Ruby 3.1.5 and 3.2.4 This fixes a number of CVEs a bugs: * https://www.ruby-lang.org/en/news/2024/04/23/ruby-3-1-5-released/ * https://www.ruby-lang.org/en/news/2024/04/23/ruby-3-2-4-released/ This will also enable us to update to Puma 6.4.2 since https://bugs.ruby-lang.org/issues/19837 has been resolved in Ruby 3.1.5. This drops the `fix-ruby-xfree-for-libxml2.patch` patch for Ruby 3.1.5 since the change has been merged upstream. --- .../ruby/3.1/fix-ruby-xfree-for-libxml2.patch | 23 ------------------- scripts/lib/custom-docker-build | 8 +++---- 2 files changed, 4 insertions(+), 27 deletions(-) delete mode 100644 patches/ruby/3.1/fix-ruby-xfree-for-libxml2.patch diff --git a/patches/ruby/3.1/fix-ruby-xfree-for-libxml2.patch b/patches/ruby/3.1/fix-ruby-xfree-for-libxml2.patch deleted file mode 100644 index 18b3d90..0000000 --- a/patches/ruby/3.1/fix-ruby-xfree-for-libxml2.patch +++ /dev/null @@ -1,23 +0,0 @@ -diff --git a/gc.c b/gc.c -index 030a4627bd..1c96f6401f 100644 ---- a/gc.c -+++ b/gc.c -@@ -11763,8 +11763,16 @@ ruby_xrealloc2_body(void *ptr, size_t n, size_t size) - void - ruby_sized_xfree(void *x, size_t size) - { -- if (x) { -- objspace_xfree(&rb_objspace, x, size); -+ if (LIKELY(x)) { -+ /* It's possible for a C extension's pthread destructor function set by pthread_key_create -+ * to be called after ruby_vm_destruct and attempt to free memory. Fall back to mimfree in -+ * that case. */ -+ if (LIKELY(GET_VM())) { -+ objspace_xfree(&rb_objspace, x, size); -+ } -+ else { -+ ruby_mimfree(x); -+ } - } - } - diff --git a/scripts/lib/custom-docker-build b/scripts/lib/custom-docker-build index 1c28bfb..876c8cd 100755 --- a/scripts/lib/custom-docker-build +++ b/scripts/lib/custom-docker-build @@ -228,13 +228,13 @@ function print_ruby_args() { ;; 3.1|3.1.patched) - RUBY_VERSION="3.1.4" - RUBY_DOWNLOAD_SHA256="a3d55879a0dfab1d7141fdf10d22a07dbf8e5cdc4415da1bde06127d5cc3c7b6" + RUBY_VERSION="3.1.5" + RUBY_DOWNLOAD_SHA256="3685c51eeee1352c31ea039706d71976f53d00ab6d77312de6aa1abaf5cda2c5" ;; 3.2|3.2.patched) - RUBY_VERSION="3.2.3" - RUBY_DOWNLOAD_SHA256="af7f1757d9ddb630345988139211f1fd570ff5ba830def1cc7c468ae9b65c9ba" + RUBY_VERSION="3.2.4" + RUBY_DOWNLOAD_SHA256="c72b3c5c30482dca18b0f868c9075f3f47d8168eaf626d4e682ce5b59c858692" ;;