ruby: Update to version 4.0.10

Message ID 20261119135512.3276857-6-adolf.belka@ipfire.org
State Staged
Commit 194be5495b11e3cc96bbaddbd467dcb25228aaf1
Headers
Series ruby: Update to version 4.0.10 |

Commit Message

Adolf Belka 19 Nov 2026, 1:55 p.m. UTC
- Update from version 4.0.9 to 4.0.10
- Update of rootfile
- 7 GHSA fixes
- Changelog
4.0.10
Security fixes
   This release fixes seven vulnerabilities.
    GHSA-34m4-m9fh-gqp5: Heap buffer overflow in case conversion of strings (#20005)
    GHSA-7x2q-68qv-6p8x: Double free in regular expression compilation (#20001)
    GHSA-87fm-7w84-j2px: Integer overflow in case conversion of strings (#20006)
    GHSA-wpqw-5qxg-m68r: Out-of-bounds read in case-insensitive regular expression matching (#20002)
    GHSA-3p8q-wmhx-vm2w: Heap buffer overflow in regular expression compilation (#20000)
    GHSA-7whj-cfh7-xgm4: Heap buffer overflow in Regexp#to_s (#20004)
    GHSA-pvgc-g7gj-pv6h: Out-of-bounds read in case-insensitive backreference matching (#20003)
String and encodings
    IO#write of a shareable String from multiple Ractors causes use-after-free (Bug #22382, #19023)
    String#initialize(encoding:) stores an inflated capacity and writes past the malloc'd buffer on append (rb_str_init termlen double-adjust) (Bug #22423, #19297, #19403)
    Coderange may be set incorrectly when concatenating a string into itself (Bug #22451, #19357)
    Use-after-free in String formatting with wide character encodings (Bug #22461, #19472)
    UTF-32 strings with a byte 0x80 or more in the most significant position are reported as valid (Bug #22495, #19646)
    Some String methods return a UTF-16/32 string without room for its terminator (Bug #22517, #19794)
    String#unpack("m") computes the buffer size with an overflowing multiplication (Bug #22518, #19797)
    Fix an out-of-bounds write in substrings of UTF-16/UTF-32 strings and an over-read when marking temporary buffers; only these two memory fixes are taken from “gc.c: Verify provided size in rb_gc_impl_free” by byroot (#15989)
    Copy terminator when moving strings to the heap. by eightbitraptor (#16201)
    Packing the buffer into itself is not possible by nobu (#16741)
    sprintf.c: Fix width overflow by nobu (#17221)
    Use the result encoding for the terminator in String#ljust/rjust/center by mame (#17260)
    Fix a potential out-of-bounds read by nobu (#17754)
    Keep the fallback string alive across rb_econv_insert_output by ko1 (#18569)
    Fix out-of-range reads and negative-length substrings in String by hsbt (#18658)
    Fix understated max_output in three transcoders by hsbt (#18661)
    Fix out-of-bounds in String#setbyte when string modified by peterzhu2118 (#18878)
    Fix use-after-free in String#[]= when string modified by peterzhu2118 (#18898)
    Fix buffer overflow in String#slice! when string modified by peterzhu2118 (#18906)
    Fix use-after-free in String#strip methods by peterzhu2118 (#18920)
    Fix use-after-free in String#each_line with separator modified by peterzhu2118 (#18925)
    Fix use-after-free in String#% when array modified by peterzhu2118 (#18931)
    Fix out-of-bounds access in String#byteindex/byterindex by peterzhu2118 (#18942)
    Fix buffer overflow in String#rpartition by peterzhu2118 (#18946)
    Fix use-after-free in String#unpack by peterzhu2118 (#18970)
    Fix crash in Array#pack when format string modified by peterzhu2118 (#19011)
    Fix overflow checks that rely on negating LONG_MIN and INT_MIN by hsbt (#19207)
    Fix integer overflow in String#[]= with a capture index of INT_MIN by mame (#19504)
    Check the terminator length in rb_str_resize and rb_str_modify_expand by mame (#19697)
    Check the size before growing the output buffer of transcoding by mame (#19798)
    Fix use-after-free when string modified in warning by peterzhu2118 (#19904)
    Fix buffer overflow in chilled string warning in String#setbyte by peterzhu2118 (#19913)
    Fix out-of-bounds for modified chilled string in String#append_as_bytes by peterzhu2118 (#19914)
    Disallow converting a buffer into itself in primitive_convert by afsozer (#19918)
    Fix overlapping memcpy in String#<< when chilled string modified by peterzhu2118 (#19920)
Regexp
    The number of captures may change depending on the encoding of the target string (Bug #22491, #19641, #19799)
    String#rindex misses a match with a leading .* in multiline mode (Bug #22492, #19643)
    Regexp search misses a match when an assertion precedes a leading .* (Bug #22494, #19645)
    Part of “Update Onigmo to 6.2.0” by nobu (#15851):
        [k-takata/Onigmo] Fix out-of-bounds read in parse_char_class()
        Now onigenc_single_byte_code_to_mbclen checks out-of-bound
        [k-takata/Onigmo] Fix that onig_new() may crash
        [k-takata/Onigmo] Fix SEGV in onig_error_code_to_str()
        [k-takata/Onigmo] Fix stack overflow with X+++++++++++++++++++…
    Check the result of compile_length_tree() at every call site by mame (#19505)
    Check remaining pattern length in str_lower_case_match by mame (#19560)
    Check the remaining length in rb_memsearch_qs_utf8_hash by mame (#19704)
Core classes
    Lazy enumerator .each_with_index ignores .take(0) before it (Bug #21142, Bug #22496, #19109, #19668)
    Assertion Failed: ary_resize_capa:RARRAY_LEN(ary) <= capacity (Bug #22333, #18907)
    Out-of-bounds in Array#sample when array modified (Bug #22449, #19384)
    Time#strftime out-of-bound access (Bug #22458, #19457)
    Array#find and Array#rfind arity change between versions 3 and 4 (Bug #22470, #19516)
    Overflow in st_init_existing_table_with_size / Hash.new(capacity:) (Bug #22512, #19773)
    Array#fill should respect frozenness from yields (Bug #22529, #19821)
    Ensure T_DATA before RTYPEDDATA_P by nobu (#15758)
    Prefer ALLOCV over ALLOCA for unknown size by nobu (#15765)
    Separate the case default_seed_bits is 0 by nobu (#16341)
    enumerator.c: guard eargs in append_method and arith_seq_inspect by dummyx (#16809)
    Add writebarrier for Array#reverse by jhawthorn (#17944)
    Fix bignum power_cache across Ractors (used by big2str/str2big) by luke-gruber (#18094)
    Marshal.load: Fix buffer overflow at overread of string body by hsbt (#18368)
    Check struct size when a user class relabels a loaded struct by hsbt (#18657)
    Fix out-of-bounds in Array#permutation when array modified by peterzhu2118 (#18951)
    Fix use-after-free in Time.new when string modified by peterzhu2118 (#18956)
    Fix use-after-free in Marshal.dump by peterzhu2118 (#18974)
    Fix out-of-bounds crash in Array#repeated_permutation by peterzhu2118 (#19095)
    Add a more defensive GC guard in Set#& by nobu (#19166, follow-up of Bug #22388)
    Do not embed arrays that will overflow length bits by peterzhu2118 (#19193)
    Do not parse past an empty string in rb_int_parse_cstr by fuzzyrichie (#19656; the pull request is titled after MatchData#integer_at, which does not exist in Ruby 4.0)
    Early return from ary_sample if the sampling number is 0 by nobu (#19673)
    Fix the digit count of rb_int_parse_cstr for all-zero input by mame (#19698)
    Fix UAF in marshall.c by eightbitraptor (#19733)
    Check reentry after comparison conversion by nobu (#19753)
    Fix signed integer overflow in rb_range_component_beg_len by gotoken (#19824)
    Fix TOCTOU in Array#pop when array frozen in to_int by peterzhu2118 (#19935)
IO, File, Process and Socket
    Socket.tcp_with_fast_fallback('example.com', 80, '127.0.0.1') fails with unknown socket domain: ipv4 (SocketError) (Bug #21512, #19363)
    IO#external_encoding / IO#internal_encoding segfault on an uninitialized IO (Bug #22410, #19252)
    IO#sysread and IO#pread are inconsistent for length 0 and negative numbers; only the check for a negative length with a buffer argument is backported (Bug #22433, #19323)
    IO#readpartial can raise EFAULT during GC.compact in another thread (Bug #22467, #19515)
    File.realdirpath returns a wrong path when GC runs while it resolves a relative symlink (Bug #22479, #19573)
    IO#gets(nil, limit) stops right after a 0xFF byte (Bug #22537, #19941)
    Process.spawn leaves the env, umask, and redirections applied in the parent on Windows when chdir: fails (Bug #22540, #19893)
    Fix: Do not fast_fallback if local_port is explicitly specified by shioimm (#15732)
    Ensure safe handling of hexdump width. by ioquatix (#16593)
    Fix IO::Buffer#each_byte bounds check by afurm (#16823)
    rb_fiber_scheduler_blocking_operation_wait can garbage collect blocking_operation incorrectly. by samuel-williams-shopify (#16908)
    Dump FreeBSD socket credential data wholely by nobu (#17214)
    io.c: use a write barrier when storing IO#timeout= by ko1 (#17670)
    Fix connection attempt fd handling in TCPSocket.new fast fallback by hsbt (#18840)
    Synchronize fast fallback cleanup with resolver threads by hsbt (#18844)
    Fix resolver error handling in TCPSocket.new fast fallback by hsbt (#18846)
    Keep stdin open when TCPSocket.new rejects open_timeout by hsbt (#19523)
    Fix fill_cbuf putting back more bytes than the current rbuf fill holds by mame (#19565)
    Lock the buffer in IO.copy_stream fallback reads by rhenium (#19618)
    Skip whitespace in rb_memory_view_parse_item_format fill pass by fuzzyrichie (#19807)
    Fix thread leaks in Socket.tcp_with_fast_fallback by nobu (c091c186e4, backported in #19810)
VM, GC, Thread and Ractor
    Thread#raise and Fiber#raise can set VM throw data as Exception#cause, causing a crash. (Bug #22541, Bug #19593, #19861)
    ruby-prof breaks on 4.0.1 (Bug #21854, #16002)
    ruby-head builds have been failing on aarch64-linux CI in ruby/ruby-dev-builder (Bug #22261, #18495)
    Hang on GC.compact (Bug #22389, #19118)
    ASan UAF and Assertion Failed: gc_validate_pc:CFP_PC(cfp) >= iseq_encoded: PC not set when allocating, breaking tracing (Bug #22409, #19250)
    Assertion Failed: vm_ep_in_heap_p_:env->ep == ep (Bug #22412, #19251)
    Array#zip with a method_missing-based argument leaks a stale block handler (segfault when the next C-called method yields) (Bug #22436, #19337)
    Thread#name= on a terminated thread may dump core (Bug #22471, #19520)
    rb_profile_frames() called from a signal handler segfaults while vm_make_env_each() is escaping a chain of frames (Bug #22476, #19559)
    rb_ec_clear_vm_stack() can still clear the VM stack before ec->cfp = NULL on aarch64 (Bug #22477, #19561)
    Proc#== does not return true for the same lexical code block (Bug #22498, #19696)
    Keyword arguments can be freed during argument setup when a method has more than 31 keywords (Bug #22500, #19679)
    Empty keyword hash mishandled when calling a Method proc through the C API (Bug #22504, #19607)
    Please backport ee90e8e (concurrent set size overcount) to 4.0: fstring table keeps doubling in long-running apps (Bug #22511, #16701)
    Release mode segfault due to half-initialized error in singleton_method (Bug #22535, #19839)
    Segfault when several Ractors call Kernel#class or #frozen? on objects of many classes (Bug #22553, #19925)
    Speedup repeated calls to rb_gccct_clear_table by byroot (#16398)
    Fix data race on heap_pages.sorted in rb_gc_register_mark_object by ko1 (#17300)
    Keep curry's argument array alive across the inner call by ko1 (#17349)
    ractor: guard the port VALUE across receive/send by ko1 (#17849)
    Part of “Fix for String without terminators” by nobu (#17882):
        Search NameError messages within string bounds
        Bound the hostname terminator search
        Bound backtrace output strings
    id_table.c: keep managed id table live across foreach/dup callbacks by ko1 (#18117)
    Raise instead of crashing when a non-T_DATA object is not shareable by ko1 (#18174)
    coroutine: do not write to the target after switching away by ko1 (#18354)
    Honor the buffer size in Darwin backtrace by nobu (#19033)
    Part of “Keep embedded TypedData pinned while their data is in use” by shugo (#19144):
        Keep a managed id table pinned while inserting into it
        Keep a lazy enumerator's proc entry pinned while its block runs
    Fix out-of-bound access of empty rest arguments array by nobu (#19387)
    Make blockparamproxy shareable by luke-gruber (#19740)
    Fix crash/hang sending to the main Ractor after fork by jhawthorn (#19840)
    Fix concurrent_set delete missing keys past an in-progress insert by jhawthorn (#19903)
    Fix off-by-one in rb_internal_thread_specific_key_create by jhawthorn (#19967)
    Fix buffer overflow in Proc#== when no env by peterzhu2118 (#19978)
Parser and compiler
    Cannot inspect RubyVM::AST for CDECL (Bug #21974, #16642)
    Jump value attaches block in incorrect place under parse.y (Bug #22450, #19411)
    Class#new shouldn't call refined initialize methods (Bug #22539, #19857)
    Segmentation fault when compiling CONST ||= value, CONST &&= value or CONST += value under # shareable_constant_value: literal (Prism compiler) (Bug #22543, #19892)
    Clarify &&= and ||= on multi-line (Bug #22556, #19943)
    parse.y segmentation fault parsing malformed nested case (Bug #22557, #19963)
    parse.y hits UNREACHABLE_RETURN(0) after compile_error in rb_parser_enc_cr_str_buf_cat (Bug #22560, #19936)
    Regexp named capture names with invalid source encoding (Bug #22597, #19981)
    parse.y rejects valid retry after a class / class << self definition inside rescue (Invalid retry after ensure) (Bug #22599, #19984)
    Add potential missing GC guard in iseq_data_to_ary by peterzhu2118 (#15810)
    Fixed the error message for ibf_load_builtin by nobu (#16723)
    Update mark bits as we go in ibf load by jhawthorn (#16787)
    compile.c: reject negative object index in the IBF loader (pinned_list_store / pinned_list_fetch) by Gengyskan (#17452)
    iseq: use RB_OBJ_WRITE for the lazy-load loader object by ko1 (#17658)
    Fix data race in rb_iseq_original_iseq by shugo (#17923)
    Keep room in the token buffer for the terminator by shugo (#17980)
    compile.c: pass the new operand ci to the write barrier, not the INSN by ko1 (#18172)
    Fix reference update bug in iseq_scan_bits by peterzhu2118 (#18527)
    Saturate parser columns at INT_MAX by hsbt (#19314)
    Set dummy ID when broken numeric by nobu (#19512)
YJIT and ZJIT
    --enable=zjit does not enable ZJIT (Bug #22427, #19307)
    YJIT: gen_struct_aset check for frozen status by byroot (#15722)
    YJIT: Add frozen guard for struct aset by tekknolagi (#15835)
    YJIT: Unlink failed batch blocks from the graph by sam-harri (#19372)
    YJIT: Fall back for explicit keywords in IFUNC block calls by thomasklemm (#19554)
    YJIT: A64: Load the absolute address for far jumps in emit_jmp_ptr by hsbt (#19718)
    JIT: Reject --{y,z}jit-exec-mem-size values that overflow the u32 reservation size by st0012 (#19720)
    YJIT: Pass the stack address to the variable-length splat guard by k0kubun (#19933)
Windows
    win32: Fix a double free and a stack over-read in path handling by hsbt (#18028)
    Part of “Win32: harden path and time handlings” by nobu (#19100):
        win32: Handle an empty system temporary path
        win32: Harden AF_UNIX socketpair path handling
    mswin: Define STACK_GROW_DIRECTION on arm64 too by hsbt (#19149)
    win32: Wait for the cancelled pipe I/O before returning by hsbt (#19522)
    Keep the getenv result per thread on Windows by hsbt (#19702)
Default gems
    Update the default gem json from 2.18.0 to 2.18.3, which includes the fix for CVE-2026-33210 (Bug #22258, #19647, #19882)
Build, installation and tests
    Run tests that require callcc by hsbt (#19687, related to Bug #20655)
    require "strscan" no longer activates the default gem, so a newer installed strscan is ignored and later loaded twice (Bug #22420, #19275)
    Ruby's release tarballs are not POSIX compliant since 2018 (Bug #22480, #19576)
    test/ruby/test_io.rb: do not set RLIMIT_NPROC by rhenium (#17147)
    test/ruby/test_process.rb: simplify testing spawn with long strings by rhenium (#17148)
    Socket#connect spec: handle EHOSTUNREACH by byroot (#19828)
    mswin: Work around an internal compiler error on ARM64 by hsbt (#19917)

Signed-off-by: Adolf Belka <adolf.belka@ipfire.org>
---
 config/rootfiles/common/ruby | 6 +++---
 lfs/ruby                     | 4 ++--
 2 files changed, 5 insertions(+), 5 deletions(-)
  

Patch

diff --git a/config/rootfiles/common/ruby b/config/rootfiles/common/ruby
index 92bae98dd..00cc54564 100644
--- a/config/rootfiles/common/ruby
+++ b/config/rootfiles/common/ruby
@@ -227,7 +227,7 @@ 
 #usr/include/ruby-4.0.0/@ARCH@-linux/ruby/config.h
 #usr/lib/libruby.so
 #usr/lib/libruby.so.4.0
-#usr/lib/libruby.so.4.0.9
+#usr/lib/libruby.so.4.0.10
 #usr/lib/pkgconfig/ruby-4.0.pc
 #usr/lib/ruby
 #usr/lib/ruby/4.0.0
@@ -1760,7 +1760,7 @@ 
 #usr/lib/ruby/gems/4.0.0/gems/irb-1.16.0/lib/irb/xmp.rb
 #usr/lib/ruby/gems/4.0.0/gems/irb-1.16.0/man
 #usr/lib/ruby/gems/4.0.0/gems/irb-1.16.0/man/irb.1
-#usr/lib/ruby/gems/4.0.0/gems/json-2.18.0
+#usr/lib/ruby/gems/4.0.0/gems/json-2.18.3
 #usr/lib/ruby/gems/4.0.0/gems/logger-1.7.0
 #usr/lib/ruby/gems/4.0.0/gems/logger-1.7.0/BSDL
 #usr/lib/ruby/gems/4.0.0/gems/logger-1.7.0/COPYING
@@ -3529,7 +3529,7 @@ 
 #usr/lib/ruby/gems/4.0.0/specifications/default/io-nonblock-0.3.2.gemspec
 #usr/lib/ruby/gems/4.0.0/specifications/default/io-wait-0.4.0.gemspec
 #usr/lib/ruby/gems/4.0.0/specifications/default/ipaddr-1.2.8.gemspec
-#usr/lib/ruby/gems/4.0.0/specifications/default/json-2.18.0.gemspec
+#usr/lib/ruby/gems/4.0.0/specifications/default/json-2.18.3.gemspec
 #usr/lib/ruby/gems/4.0.0/specifications/default/net-http-0.9.1.gemspec
 #usr/lib/ruby/gems/4.0.0/specifications/default/net-protocol-0.2.2.gemspec
 #usr/lib/ruby/gems/4.0.0/specifications/default/open-uri-0.5.0.gemspec
diff --git a/lfs/ruby b/lfs/ruby
index 74f2c6235..1a2a49b16 100644
--- a/lfs/ruby
+++ b/lfs/ruby
@@ -24,7 +24,7 @@ 
 
 include Config
 
-VER        = 4.0.9
+VER        = 4.0.10
 
 THISAPP    = ruby-$(VER)
 DL_FILE    = $(THISAPP).tar.gz
@@ -44,7 +44,7 @@  objects = $(DL_FILE)
 
 $(DL_FILE) = $(DL_FROM)/$(DL_FILE)
 
-$(DL_FILE)_BLAKE2 = 660ec701a762d5e9c89eb14636bcc2c4cd02d68c92bdf3154c89a3bf444c505bf1f197e9db7707e498a40653fec736532909aed9a182e06821cebd2aab8273d3
+$(DL_FILE)_BLAKE2 = 98771c27f356a216a53c2452f75de71d633a7f4ba6ca7c6afa5a0ae75c2e442fd7ac6cf30ed70319c7576c4ad60c44b341ca4ff7e0d04018a4f3fcdca1eeeed4
 
 install : $(TARGET)