90003 Commits

Author SHA1 Message Date
Hiroshi SHIBATA
2f3cdc0a1c Fix callcc availability checks in tests
`callcc` is a private global function, so `respond_to?(:callcc)` is always false and these tests have been skipped since 5621d794a2. Builds that disable `callcc` still skip them, because `respond_to?` returns false for not-implemented methods even with `include_all`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit 3a3a921ac6c02b4269a2c6d4c6cb30d06fa6892e)
2026-11-06 22:34:39 +09:00
Hiroshi SHIBATA
0d696e9530 Remove Hash tests for re-entering iteration with callcc
ac5ac48a36 removed the ensure rollback these tests exercise. They were left behind because `respond_to?(:callcc)` always skipped them, and they fail once that check is fixed.

[Bug #20655]

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit 1d490a00b21a3efac5b65b26ef7c1057fbc776f2)
2026-11-06 22:34:39 +09:00
Lars Kanis
dee5b35bbf Fix callcc on Windows on ARM64
Otherwise using callcc fails with a segfault for instance in this test case:
  TestEnsureAndCallcc#test_bug20655_extension_using_rb_ensure

(cherry picked from commit 142001cd64fcb7ec6896f04b0c837857590e26ce)
2026-11-06 22:34:39 +09:00
Thomas Klemm
9350473ec8 YJIT: Fall back for explicit keywords in IFUNC block calls
The IFUNC fast path passes raw keyword values to rb_vm_yield_with_cfunc
without packing them into a Hash. For example, an Enumerable iterator
that yields [], key: i loses the keyword name when called by each_slice.

Use VM dispatch for VM_CALL_KWARG, as for keyword splats, so argument
setup preserves the keywords.

(cherry picked from commit 54d098816777fd29e716746c2adcb3bbe4f88710)
2026-11-06 22:16:53 +09:00
John Hawthorn
98ba0a86a3 Don't write str2's code range back in rb_str_buf_append
Since rb_enc_str_coderange(str2) is called first, str2_cr is never
UNKNOWN and rb_enc_cr_str_buf_cat returns it unchanged, so writing it
back to str2 is redundant. It is also an unsynchronized write to str2,
which may be a frozen string shared with other Ractors.

When str and str2 are the same string, the write-back also overwrote
the result's code range with the pre-append one, so `s << s` could
leave a valid string marked BROKEN.

[Bug #22451]

(cherry picked from commit b740f7d553e6ee4abdff8847760394b4e6ea389c)
2026-11-06 22:14:51 +09:00
Hiroshi SHIBATA
d1828a7637 YJIT: A64: Load the absolute address for far jumps in emit_jmp_ptr
Since a1c61f0ae5 made CodePtr an offset into the code region, the fallback for targets out of the range of b has loaded that offset for br instead of the address. The fallback is taken once the code region exceeds 128MiB, with --yjit-exec-mem-size or with --yjit-mem-size when that is not given.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-06 21:31:27 +09:00
Stan Lo
635f4d2eed JIT: Reject --{y,z}jit-exec-mem-size values that overflow the u32 reservation size (#19720)
(cherry picked from commit 9bfa7c99a6b4b115318e63d92438f1a92cfbb9ed)
2026-11-06 21:10:20 +09:00
nagachika
0b68e9b9d8 merge revision(s) 72bd3f40ccbab0596b37f7d4d391a5cd21c5392e:
[PATCH] Check the remaining length in rb_memsearch_qs_utf8_hash

	The hash of the UTF-8 quick search read the following bytes of a
	multibyte lead byte without checking the end of the string. Treat a
	truncated character at the end as a single byte.

	Reported-by: Claudio Gradi (https://hackerone.com/cgradi)
	Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 22:00:37 +09:00
nagachika
0aeb21f336 merge revision(s) fef67df22408cd8de42592a0f8a8dc8ed17f0b91:
[PATCH] Do not drop substring before match in middle of char
2026-11-04 21:52:51 +09:00
nagachika
1565adc5b9 merge revision(s) ba68343d3ad0465ae9cdaf786dd100b9ed0add07: [Backport #22456]
[PATCH] Allow wakeup mutex to be used in trap context. (#13684)
2026-11-03 17:14:07 +09:00
nagachika
a260ee3b3d merge revision(s) 31a3aa4e46dd33b5a08708d687ed9f9d3253b55a: [Backport #22450]
[PATCH] [Bug #22450] Preserve do-block binding in control-flow arguments

	Inherited `CMDARG` state made `do` blocks in control-flow arguments
	bind to the wrong call.
2026-11-03 13:55:49 +09:00
nagachika
aa49c48608 merge revision(s) 88ffa9a3003c36e5c6001cca33e0bba2fcb37125: [Backport #22449]
[PATCH] [Bug #22449] Fix out-of-bounds in `Array#sample` when array modified

	Get the length after the conversion using `to_int` is complete.
2026-11-03 13:52:44 +09:00
nagachika
5ef939e530 merge revision(s) 054385feb134d19b2130238a76004c204f96293b: [Backport #22436]
[PATCH] Fix ifunc block handler leak from method_missing

	[Bug #22436]

	The check_funcall_exec function incorrectly restored the pending block
	handler which causes it to leak.

	For example, the following code crashes:

	    o = Object.new
	    def o.method_missing(*) = nil   # Array#zip calls o.each via method_missing

	    out = Object.new
	    def out.write(*) = nil
	    def out.puts(*) = yield         # receives a block it was never given
	    $stdout = out

	    [1].zip(o)
	    puts 1                          # Kernel#puts -> $stdout.puts gets a stale ifunc block
2026-11-03 13:44:20 +09:00
nagachika
2b884b078d merge revision(s) 54cc01ede02b6cca15eeded10842c5d4ab11b9e4: [Backport #22416]
[PATCH] [Bug #22416] Respect timezone abbreviation encodings in strftime

	Timezone objects can return abbreviations in encodings beyond the
	locale.  Respect their encoding when formatting `%Z` to avoid
	misinterpreting their bytes.
2026-11-03 13:43:06 +09:00
nagachika
4fb2c3b90a merge revision(s) 0f4f0b6d23c4d3e6d11f6f4071a79cb04eaee65a:
[PATCH] [ruby/rubygems] Probe socket errors via SO_ERROR in TCPSocketProbe

	Calling connect_nonblock a second time to confirm a non-blocking
	connect is not portable. On BSD-based systems such as macOS the second
	connect returns EISCONN even after the asynchronous connect failed with
	ECONNREFUSED, so a down mirror was reported as reachable. Check the
	pending socket error with getsockopt(SO_ERROR) once IO.select reports
	the socket writable instead.

	https://github.com/ruby/rubygems/commit/b953dbd3c8

	Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-11-03 12:53:54 +09:00
Takashi Kokubun
8b8d1d9467 Add a missing dependency
https://github.com/ruby/ruby/pull/19622

(cherry picked from commit 95a0b20120f5f2cc4b463195d76d5de83c5db791)
2026-10-31 21:48:23 +09:00
Benoit Daloze
9e2c209252 Restore the previous SIGPROF action when stopping the sampler
The test sampler left its SIGPROF handler installed after stopping, as a
SIGPROF sent just before stopping might still be pending and would then
be delivered to the previous action, which terminates the process for
SIG_DFL.

Instead, make the sampler thread wait for each signal to be handled
before sending the next one, so that no SIGPROF is pending once it is
joined. Then save the previous action when starting and restore it when
stopping.

[Bug #22476]

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit ca1ec04e0ad69764185a5d7e65c73a5924ea9b48)
2026-10-31 21:48:23 +09:00
Benoit Daloze
87c47abd6e Set the flags of the heap ep before cfp->ep points to it
The heap ep is meant to be fully initialized before cfp->ep and the
child ep point to it, as rb_profile_frames() might read it from a signal
handler. VM_ENV_FLAG_ESCAPED and VM_ENV_FLAG_WB_REQUIRED were however
set after the store to cfp->ep. This was harmless for rb_profile_frames()
since it does not check these flags, but move setting them before the
signal fence so cfp->ep never points to a heap ep which is not marked as
escaped.

[Bug #22476]

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit 08a10375fe449867079d01d324ead1deb095b38b)
2026-10-31 21:48:23 +09:00
Benoit Daloze
7b98007cfb Add signal fences to vm_make_env_each() for rb_profile_frames()
rb_profile_frames() can be called from a signal handler on the same
thread, so the order of the stores in vm_make_env_each() matters even
though no other thread observes them. The compiler could otherwise
reorder them: env_body is malloc'ed memory which is known not to alias,
and with strict aliasing the store to cfp->ep (a pointer) may be
reordered with the overwrite of the on-stack ep flags (a VALUE).

Like in vm_push_frame(), use atomic_signal_fence() to ensure the heap
ep is initialized before cfp->ep and the child ep point to it, and that
those are updated before the on-stack ep flags are overwritten.

With Apple clang 21 on arm64 and clang 20 on x86_64, the machine code of
vm.o is identical with and without these fences. With GCC 16 on arm64
and GCC 13 on x86_64, they prevent hoisting the update of the heap ep
flags above the store to cfp->ep. The stores to child_ep and the
on-stack ep stay in source order without the fences with all of these
compilers.

[Bug #22476]

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit db6aebc5c1bf304034e74145266bf47555be8fe7)
2026-10-31 21:48:23 +09:00
Benoit Daloze
fa7e1a4c2e Keep env chains walkable by rb_profile_frames() in vm_make_env_each()
vm_make_env_each() first escapes the parent frame, which overwrites the
flags of the parent's on-stack ep with the env object, and only then
updated the child frame to point to the parent's heap ep. If a signal
handler called rb_profile_frames() in between, as sampling profilers do,
rb_vm_frame_method_entry_unchecked() followed the child frame to the
overwritten on-stack ep, treated it as non-local and, if the parent had
no method entry (e.g. a class body), dereferenced VM_BLOCK_HANDLER_NONE
as the next ep and segfaulted.

Now the child frame is updated to point to the heap ep before the
on-stack ep of the parent is overwritten.

On x86_64 Linux with GCC 13, the new test segfaults in about half of
the runs without this change, and passed 30 out of 30 runs with it.
On macOS arm64 with Apple clang 21, it segfaulted in 4 out of 4 runs
without this change, and passed 5 out of 5 runs with it.

[Bug #22476]

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit 9c217d461608f440a7c16fb00ce4f80fd472dab2)
2026-10-31 21:48:23 +09:00
nagachika
72d9d4b935 merge revision(s) 670f6c1541838af7f0d945af63745ff8d0438122: [Backport #22479]
[PATCH] Keep the symlink target alive while realpath_rec reads it

	realpath_rec reads the names of a symlink target through a raw pointer
	into the string returned by rb_readlink, while it calls itself to resolve
	those names. RB_GC_GUARD(link_orig) keeps that string alive only for an
	absolute target. For a relative target, link_orig is Qnil and nothing
	uses `link` after the recursive call, so GC can free the string while the
	later names are still being read.

	File.realdirpath then returns a wrong path: the unresolved symlink path,
	or a path with NUL bytes, which makes Pathname.new raise "pathname
	contains null byte". CocoaPods calls Pathname#realdirpath for every
	source file, and pnpm installs packages behind relative symlinks, so
	`pod install` fails at random in such projects.

	File.realpath is not affected on platforms with realpath(3), because only
	RB_REALPATH_DIR uses realpath_rec there.

	Fixes [Bug #22479]
2026-10-28 21:31:46 +09:00
Benoit Daloze
fc063c9772 Add a signal fence in rb_ec_clear_vm_stack()
Since the fix for Bug #21441, ec->cfp is set to NULL before clearing
the VM stack so that thread_profile_frames() called from a signal
handler returns early instead of walking a stack that is no longer set
on the ec. But these are plain stores to distinct fields of the same
struct, so the compiler is free to reorder them.

With Apple clang 21 and GCC 16 on macOS arm64, and with clang 18 and
GCC 13 on Linux aarch64, both stores of rb_ec_set_vm_stack() were
combined into a single stp emitted before the store to ec->cfp
(vm_stack is at offset 0, vm_stack_size at 0x8 and cfp at 0x10):

    stp xzr, xzr, [x0]        ; ec->vm_stack = NULL, vm_stack_size = 0
    str xzr, [x0, #0x10]      ; ec->cfp = NULL
    ret

So a signal in between would see a non-NULL ec->cfp with a NULL
ec->vm_stack. Stopping there in lldb when a thread terminates and
calling rb_profile_frames() segfaults in thread_profile_frames(), as
end_cfp is computed from the NULL ec->vm_stack and the loop walks past
the control frames. With this change, ec->cfp is already NULL at that
point and rb_profile_frames() returns 0.

Like in vm_push_frame(), use atomic_signal_fence() to keep the store to
ec->cfp first. With it, all these compilers emit the store to ec->cfp no
later than the stores clearing the stack. The rest of vm.o is unchanged
with Apple clang 21, GCC 16 and GCC 13 on aarch64. Clang 21 and 18:

    stp xzr, xzr, [x0, #0x8]  ; ec->vm_stack_size = 0, cfp = NULL
    str xzr, [x0]             ; ec->vm_stack = NULL
    ret

GCC 16 and 13:

    str xzr, [x0, #0x10]      ; ec->cfp = NULL
    stp xzr, xzr, [x0]        ; ec->vm_stack = NULL, vm_stack_size = 0
    ret

With GCC 13 on x86_64, the store to ec->cfp is already emitted first
without the fence, and vm.o is identical with and without it:

    endbr64
    movq $0x0, 0x10(%rdi)     ; ec->cfp = NULL
    movq $0x0, (%rdi)         ; ec->vm_stack = NULL
    movq $0x0, 0x8(%rdi)      ; ec->vm_stack_size = 0
    ret

[Bug #22477]

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-28 21:04:28 +09:00
nagachika
1efcec846a merge revision(s) 3a55e5c6d34728ffcb5158dd7c36643e11c37f04:
[PATCH] Discard unreachable exception table entries

	Dead labels can leave invalid catch entries that make ensure clauses
	run for code that cannot be reached.
2026-10-25 22:50:27 +09:00
Hiroshi SHIBATA
366f5fdc00 Keep the program size error from OP_END with subexp calls
With a subexp call, the result of unset_addr_list_fix overwrote the error, so a pattern over the limit compiled without raising RegexpError.

Follow-up to cf35145fc46.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
v3_4_12
2026-10-23 12:07:44 +09:00
nagachika
103bb84d1b Bump teeny version to 3.4.12. 2026-10-23 11:48:02 +09:00
Sethu
d64496b422 [Bug #22384] Fix memory leak on compile error in a later branch of an alternation
(cherry picked from commit bf937bfa16767a4dd857ee16f4f18df1bae4d5ca)
2026-10-23 11:43:06 +09:00
nagachika
8d4a42139b merge revision(s) 493d26dcdea8b2f0ac5d28e057b401bc809e7fae:
[PATCH] Reject overflowed repeat/null-check IDs in huge regexps (#16801)

	Add explicit errors for excessive range-repeat and null-check IDs;
	map new errors in regerror; add regression tests for oversized generated
	patterns.
2026-10-22 21:55:13 +09:00
Douglas Eichelberger
50f6624862 Reset the fork lock in the child without unlocking it
A thread that is waiting for the fork lock when another thread forks
exists only in the parent, but on macOS the child's copy of the lock
still counts it. After the child unlocks its copy,
pthread_rwlock_destroy() and pthread_rwlock_init() fail with EBUSY, so
the child aborts with
"[BUG] pthread_rwlock_destroy: Resource busy (EBUSY)". Lookup threads
wait for the lock whenever a fork holds it, so a process that resolves
names in background threads while it forks loses a child now and then.

Reset the child's copy by assigning PTHREAD_RWLOCK_INITIALIZER, as
rb_internal_thread_event_hooks_rw_lock_atfork() does for its lock, and
do not unlock it first. With a waiter counted, macOS's unlock enters the
kernel to wake it, and the state that leaves behind for the lock's
address survives the assignment, so a later waiter in the child can
sleep forever although no thread holds the lock. FreeBSD already skipped
the unlock in the child (dc8c382266), and on glibc the child's unlock
does not release the write lock anyway.

[Bug #22445]
2026-10-17 20:37:04 +09:00
Douglas Eichelberger
56c3e7ea7b Join getaddrinfo and getnameinfo threads before fork
A getaddrinfo thread calls getaddrinfo(3) inside rb_thread_prevent_fork,
but on glibc its thread exit takes the resolver configuration lock again
after the thread has released the fork lock. A fork that lands then
leaves the child with that lock held, and every later name lookup in the
child blocks forever. getnameinfo(3) attaches the same resolver state,
even for a name in /etc/hosts, and its thread ran outside
rb_thread_prevent_fork altogether.

Make the lookup threads joinable and have fork join any that may still
be exiting. As a lookup thread finishes, still inside
rb_thread_prevent_fork, it swaps itself into a single slot with an
atomic exchange and joins the thread it displaced, which has usually
exited by then, and rb_thread_acquire_fork_lock joins whatever is left
in the slot. Once lookups settle, at most one finished thread is left
unjoined. The slot holds pthread_t as a pointer, with NULL for empty,
which assumes pthread_t is scalar and never 0.

getnameinfo threads now run within rb_thread_prevent_fork and register
as they exit, as getaddrinfo threads do, and where getnameinfo runs
without a helper thread it is called within rb_thread_prevent_fork too.
So fork also waits for a reverse lookup in progress, as it already did
for a forward one. raddrinfo_pthread_create now always creates joinable
threads, which drops its pthread_detach fallback for platforms without
pthread_attr_setdetachstate.

The slot is kept across fork, so every fork path that keeps running
Ruby code has to take the fork lock. On the BSDs, Process.daemon forks
with daemon(3) and did not take it, so the daemon would inherit the
registered thread, and its next fork would abort in pthread_join with
ESRCH. Take and release the fork lock around daemon(3) as rb_fork_ruby
does. daemon(3) can fail in the child as well as in the parent, so
compare pids to tell which process returned.

[Bug #22406]

(cherry picked from commit 44f7c6b00d3263c9c81af58e77eeb79eaec7bd0e)
2026-10-17 14:24:19 +09:00
Randy Stauner
79214e7c6e [Backport #22415] Restore ec->errinfo after handling interrupts
Interrupts are checked at arbitrary points, including while a jump
(break/next/redo/return/raise/throw) is being propagated, and the payload
of that jump lives in ec->errinfo.

Handling an interrupt can run Ruby code: rb_signal_exec() runs a trap
handler and threadptr_interrupt_exec_exec() runs interrupt_exec tasks.
Neither preserves ec->errinfo, and any rescue or ensure clause that code
enters sets it to nil.

Thread.handle_interrupt checks for interrupts after its block returns but
before re-raising the jump that left the block.  If a signal handler runs
in that window the throw data is replaced with nil and the VM dereferences
nil as a vm_throw_data:

    THROW_DATA_CATCH_FRAME (obj=0x4) at vm_insnhelper.h:217
    vm_exec_handle_exception (ec=..., errinfo=4) at vm.c:2880
    vm_exec_loop / rb_vm_exec at vm.c:2829 / vm.c:2812
    invoke_iseq_block_from_c / rb_yield / rb_ary_each

rb_postponed_job_flush() and rb_exec_event_hooks() already save and restore
ec->errinfo around the Ruby code they run; do the same for the rest of
rb_threadptr_execute_interrupts().  The paths that set errinfo on purpose
(rb_exc_raise, rb_threadptr_to_kill) jump out of the function and so do not
reach the restore.
2026-10-17 14:16:01 +09:00
Erik Berlin
26a4d835f7 Fix Range#include? of an empty range of single characters
A range of single character Strings told that it includes its end
even when it is empty, since the end was not compared with the begin.

    ("z".."a").to_a          #=> []
    ("z".."a").include?("a") #=> true

(cherry picked from commit 1bf91309438d071359aa521328074cc6ec293299)
2026-10-17 13:21:36 +09:00
nagachika
d14d56f1d3 merge revision(s) b3598cf2a355497693bb66097edc156af3152e9b:
Win: Strip CRs from `cpp` and `nm` output

	The combination of mingw tools and cygin/msys2 ruby leaves CRs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-17 13:16:06 +09:00
nagachika
98ec35899b merge revision(s) b0a4e2399b34701d4fc05f9543142b0c73d1fb9b:
CI: mingw: Use the official actions for msys2

	Because ruby/setup-ruby is affected to test result.

Also includes the prerequisite changes from e4b386e090, 90f8199412,
a443cd012a and 4adb6f6969 (Remove Strawberry Perl pkg-config, misc
system & package info, `cmd` as the default shell, set up msys2
environment variables).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-17 13:16:06 +09:00
nagachika
2d4992fc9d Fix pm_memchr constness.
cast memchr result (or make return const void *) to resolve -Werror incompatible-pointer-types"
2026-10-17 00:39:00 +09:00
nagachika
89856b96b1 Bump ruby/setup-ruby to v1.329.0
setup-ruby v1.236.0 raises "Cannot find Git's cert file" on Windows
runners because Git for Windows moved from mingw64 to ucrt64.
This was fixed in ruby/setup-ruby#947 (v1.328.0).
2026-10-17 00:35:56 +09:00
Étienne Barrié
e068856616 Remove discard qualifiers warning with C23 strchr
C23 has qualifier-preserving standard library functions, so calling
strchr with a `const char *` will return a `const char *`. We can change
the type of the local variables because we don't mutate the strings.
2026-10-16 21:38:29 +09:00
Hiroya Fujinami
8382f95cfd Prevent double free for too big repetition quantifiers (#13332)
Prevent double free for too big repetition quantifiers

The previous implementation calls `free(node)` twice (on parsing and compiling a
regexp) when it has an error, so it leads to a double-free issue. This
commit enforces `free(node)` once by introducing a temporal pointer to hold
parsing nodes.

(cherry picked from commit 35000ac2ed3a1829f8d193ffb23da0e44cc6fe5f)
2026-10-12 17:22:46 +09:00
Hiroshi SHIBATA
2d1859ffa6 Reject a compiled program too big for its offset type
Concatenated large repeats reach a program past INT_MAX from a few hundred
kilobytes of source, and the offsets emitted into it wrap.  Cap the size
while the program is emitted, which does not depend on the length pass that
overflows along with it.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-10-12 17:21:24 +09:00
Hiroshi SHIBATA
f800509896 Avoid overflow in the quantifier expansion size check
Nested bounded repeats let the int product tlen * qn->lower overflow, so
the check that keeps the compiler from unrolling a large repeat could pass
for an enormous one, hanging the compile or emitting wrapped jump offsets.
Compare against the limit by division instead.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-12 17:21:24 +09:00
nagachika
f5cef120e9 merge revision(s) 2d08b5f42f2cbed4a4e6ecf8d62987a4f21f98c1: [Backport #22423]
[PATCH] [Bug #22423] Preserve encoding with `String` capacity
2026-10-12 14:22:20 +09:00
nagachika
a1c96b6b0f merge revision(s) 3f6143715aa934b558f0b97462b42793c845e4d7: [Backport #22326]
[PATCH] Fix buffer overflow in Array#values_at

	Array#values_at can execute arbitrary code during execution which may
	modify the source array. This can cause a buffer overflow if the new length
	of the array has decreased. The following script crashes:

	    a = (0..100_000).to_a
	    obj = Object.new
	    obj.define_singleton_method(:begin) do
	      a.clear
	      0
	    end
	    obj.define_singleton_method(:end) { 10_000 }
	    obj.define_singleton_method(:exclude_end?) { false }
	    puts a.values_at(obj).length
2026-10-12 14:20:29 +09:00
nagachika
357795cca8 merge revision(s) 9267f6fba084710cff11b660e8758aec29886682, 3ea4bc3f79a913e03ee1b1ea3e21572ee8036095, badce4d07961e8c9c6ac68f15ae7b01ba1985421: [Backport #22388]
[PATCH] [Bug #22388] Fix use-after-free in `Enumerator::Lazy#flat_map`

	[PATCH] [Bug #22388] Fix use-after-free in `Set#&`

	[PATCH] Add a more defensive GC guard
2026-10-12 13:52:04 +09:00
nagachika
f7e692b6cd merge revision(s) c861619e891632aeeb42907b17003dbc9fbf5f2f, 3ac822c7e1d1983711710b3d8549b8e9898df944: [Backport #22388]
[PATCH] [Bug #22388] Fix use-after-free in some `Enumerable` methods

	[PATCH] [Bug #22388] Fix use-after-free in `Enumerable#sum`
2026-10-12 13:34:44 +09:00
nagachika
eb6033eb58 merge revision(s) c4f93eb297c5723673d961db8eee390cbcdf5069: [Backport #22391]
[PATCH] io: preserve errno across `rb_io_wait()` call. (#19121)

	[Bug #22391]
2026-10-12 13:32:04 +09:00
Randy Stauner
cc3e2b9687 [Backport 3.4] [Bug #22387] Fix termlen in str_shared_replace
The buffer is copied over based on the new string's termlen
so we can just set the new encoding raw
instead of recalculating based on the old encoding's termlen.
2026-10-12 13:24:35 +09:00
Hiroshi SHIBATA
e9cd5b3710 Stop using the macos-14 runner image
GitHub retires the macOS 14 image on November 2, 2026. Jobs that ran only there move to macos-15, the oldest remaining image, and the matrices that also cover newer images drop it.

https://github.blog/changelog/2026-10-01-github-actions-macos-14-runner-image-retirement/

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-07 06:12:14 +09:00
st0012
f297fc4b38 Use ubuntu-latest for macOS result jobs
The result jobs in macOS workflows only check if other jobs failed
(just runs `exit 1`). They don't need macOS runners. Using
ubuntu-latest instead frees up macOS runner slots and starts faster
due to shorter queue times.
2026-10-07 06:12:14 +09:00
nagachika
8dd3d5b5e5 merge revision(s) ec3b6b12e7fdd9eb833ba867eb862956a85f424b, f021cc2f138061c292afe4be0389f6c7ec804e28, 020ccecec39c8f43ba7120b3b9079ec6b7d9ea80: [Backport #22284]
[PATCH] [Bug #22284] Fix curry with a non-Fixnum arity on LLP64

	FIX2INT does not call to_int where int and long have the same size, so `method(:puts).curry(1r)` waited for a garbage number of arguments on Windows. Convert the arity once and keep the result as a Fixnum, which also limits the to_int call to one.

	[PATCH] [Bug #22284] Let NUM2INT handle Fixnum arity of curry

	NUM2INT already takes the Fixnum path by itself.

	[PATCH] [Bug #22284] Test curry with an arity that responds to to_int

	It also counts the to_int calls, so it fails on LP64 platforms too, where the old code converted the arity again on every call.
2026-10-04 19:29:33 +09:00
nagachika
0a33ab92c0 merge revision(s) 227006291d35b2255b3f7a888d75102c129b0472: [Backport #22342]
[PATCH] Fix IO#gets ignoring the limit argument

	IO#gets first searches for separator candidates by looking for the last
	byte of the record separator, and then checks whether it is an actual
	match.

	If a candidate is found at limit-th byte of the stream but is rejected
	because it does not start at a character boundary, the limit check is
	incorrectly skipped.

	[Bug #22342]
2026-09-26 21:38:21 +09:00
nagachika
592f1ffdb3 Bump v3.4.11. v3_4_11 2026-09-23 14:32:40 +09:00