18423 Commits
Author SHA1 Message Date
Sethu 745e06b1b0 [Bug #22384] Fix memory leak on compile error in a later branch of an alternation
(cherry picked from commit bf937bfa16)
2026-10-23 12:00:20 +09:00
Hiroshi SHIBATA fa98ef030a 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>
(cherry picked from commit 7cfe8dc82f)
2026-10-23 12:00:20 +09:00
Hiroya Fujinami 63eda2681e 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.

(cherry picked from commit 493d26dcde)
2026-10-23 12:00:20 +09:00
Hiroya Fujinami 63d0ba80a7 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 35000ac2ed)
2026-10-23 12:00:20 +09:00
Peter Zhu 52c54450f9 Don't use non blocking pipes for RUBY_CRASH_REPORT
[Bug #21703]

RUBY_CRASH_REPORT does not work in some cases when shelling out on Linux.
For example, given the following shell script dump.sh:

    #!/usr/bin/env bash
    cat > /tmp/crash

And we see it fails like this:

    $ RUBY_CRASH_REPORT="|dump.sh" ruby -rfiddle -e "Fiddle::Pointer.new(1, 10)[0]"
    cat: -: Resource temporarily unavailable
2026-09-17 09:54:30 +09:00
Nobuyoshi Nakada fead12a314 Use assert_crash_report in test_crash_report_pipe
Instead of using `assert_in_out_err` directly.
2026-09-17 09:54:30 +09:00
Nobuyoshi Nakada 94b8dbc104 Fix crash report path test on Windows 2026-09-17 09:54:30 +09:00
Nobuyoshi Nakada 176b4c14ed Fix to use assert_crash_report results 2026-09-17 09:54:30 +09:00
Hiroshi SHIBATAandClaude Opus 5 619ea0f602 Bump up resolv-0.3.2 for Ruby 3.3
Backport of the August 2026 resolv security release.

CVE-2026-80212
CVE-2026-80213

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-28 11:25:26 +09:00
Hiroshi SHIBATA b823e24509 Omit unknown DNS issue of macOS 26.1 beta
```
TestResolvDNS#test_no_server:
Test::Unit::ProxyError: Timeout::Error
    /path/to/ruby/test/resolv/test_dns.rb:531:in 'TestResolvDNS#test_no_server'
```
2026-06-10 06:17:31 +09:00
Kazuki Yamaguchi 1fbf9abe85 Merge openssl-3.2.4
The changes can be found at:

    https://github.com/ruby/openssl/compare/v3.2.3...v3.2.4
2026-05-14 13:59:53 +09:00
Takashi KokubunandTristan Madani a53f3d57d1 [ruby/erb] Prohibit def_method on marshal-loaded ERB instances
Extends the @_init guard to def_method so that an ERB object created
via Marshal.load (which bypasses initialize) raises ArgumentError
instead of evaluating arbitrary source. def_module and def_class both
delegate to def_method and are covered by the same check.

Co-authored-by: Tristan Madani <TristanInSec@gmail.com>
2026-04-22 09:36:32 +09:00
Nobuyoshi Nakada 59a72538b6 [ruby/pstore] Define the platform constant
Rather than overwriting the predicate method dynamically.

Fix [Bug #21880](https://bugs.ruby-lang.org/issues/21880).

https://github.com/ruby/pstore/commit/b2e474e619
2026-03-26 08:42:02 +09:00
Hiroshi SHIBATA 6809c69f62 [ruby/pstore] Added lib path to in assert_in_out_err
https://github.com/ruby/pstore/commit/b563c4d354
2026-03-26 08:41:55 +09:00
Hiroshi SHIBATA acfdc0ac88 merge revision(s) 54c4694994: [Backport #21961]
[PATCH] marshal.c: properly freeze linked strings

	[Bug #21961]
2026-03-26 08:34:22 +09:00
Hiroshi SHIBATA fecabc3145 Revert "merge revision(s) 190b017fc6: [Backport #21703]"
This reverts commit 83637aea6e.
2026-03-24 15:39:44 +09:00
Hiroshi SHIBATA 3cd6323fbb merge revision(s) d7a6ff8224: [Backport #21819]
[Bug #21819] Data objects without members should also be frozen
2026-03-24 14:49:12 +09:00
Hiroshi SHIBATA 930edc12d7 merge revision(s) 19e539c9ee: [Backport #21814]
[Bug #21814] Fix negative bignum modulo

	If modulo is zero, do not  apply bias even if the divisor is zero.
	`BIGNUM_POSITIVE_P` is true even on bignum zero.
2026-03-24 14:49:12 +09:00
Hiroshi SHIBATA c675ec66e9 merge revision(s) 1e7cf7b2bc: [Backport #21446]
[PATCH] Fix refinement modification of method visibility in superclass

	Previously, this didn't work correctly, resulting in a
	SystemStackError. This fixes the issue by finding the related
	superclass method entry, and updating the orig_me in the
	refinement method to point to the superclass method.

	Fixes [Bug #21446]
2026-03-24 14:49:12 +09:00
Hiroshi SHIBATA 83637aea6e merge revision(s) 190b017fc6: [Backport #21703]
[PATCH] Don't use non blocking pipes for RUBY_CRASH_REPORT

	[Bug #21703]

	RUBY_CRASH_REPORT does not work in some cases when shelling out on Linux.
	For example, given the following shell script dump.sh:

	    #!/usr/bin/env bash
	    cat > /tmp/crash

	And we see it fails like this:

	    $ RUBY_CRASH_REPORT="|dump.sh" ruby -rfiddle -e "Fiddle::Pointer.new(1, 10)[0]"
	    cat: -: Resource temporarily unavailable
2026-03-24 14:49:12 +09:00
Hiroshi SHIBATA 513ee91b38 Merge zlib-3.1.2 2026-03-10 15:58:44 +09:00
Randy Stauner 0cba8cf414 YJIT: Bail out if proc would be stored above stack top
Fixes [Bug #21266].

Backport of 9168cad4d6 to 3.3
2026-03-04 15:45:16 +09:00
Mike Dalessio b952b6f099 Fix UnboundMethod#== for methods from included/extended modules [Backport #21873]
Method#unbind clones the method entry, preserving its defined_class.
For methods mixed in via include/extend, defined_class is an ICLASS,
causing UnboundMethod#== to return false when comparing against the
same method obtained via Module#instance_method.

Resolve ICLASS defined_class in method_eq.

[Bug #21873]
2026-02-12 15:05:36 +09:00
Hiroshi SHIBATA 10876c271b Skip test_crash_report_pipe with macOS 15 2025-12-15 17:38:38 +09:00
Hiroshi SHIBATA d69dff1d7d macOS 15 is the stable version today 2025-12-15 17:38:38 +09:00
Nobuyoshi Nakada 3563a0db80 Add predicates for platforms 2025-12-15 17:38:38 +09:00
Hiroshi SHIBATA c98aa9771e Pend some tests because these are not working with macOS 15 beta and Xcode 16 beta 2025-12-15 17:38:38 +09:00
nagachika 1974ccabbf merge revision(s) beb85e7eee: [Backport #21705]
[PATCH] [Bug #21705] Fix segfaults on Windows

	It should check the type of the argument and coercion before
	converting the encoding.
2025-11-30 10:36:56 +09:00
nagachika bc21e4d40d merge revision(s) f4f728b319: [Backport #21680]
[PATCH] [Bug #21680] Fix (base**power_of_two).digits(base) bug (#15144)

	Fix wrong condition in base multiplying loop.
2025-11-30 09:45:51 +09:00
nagachika c4b8891554 merge revision(s) c5bd4acd30: [Backport #21666]
[PATCH] [Bug #21666] Get rid of use of unspecified values
2025-11-29 12:31:08 +09:00
nagachika 62135b9da4 merge revision(s) a4dff09be7: [Backport #21673]
[PATCH] [Bug #21673] Fix resolving refined module-defined method

	A method defined in a module has no `defined_class`, use the ICLASS
	for it as the `defined_class`.
2025-11-29 12:28:14 +09:00
nagachika e897657c00 merge revision(s) 377aa2a336: [Backport #21668]
[PATCH] Improve performance of UnicodeNormalize.canonical_ordering_one

	Use array_of_integer.sort! instead of buble-sort-like algorithm
2025-11-08 11:05:47 +09:00
K.Takata cd116d2ac5 Fix initialization of the table for quick search
This fixes k-takata/Onigmo#120.

The commit k-takata/Onigmo@9c13de8d06 was insufficient.

https://github.com/k-takata/Onigmo/commit/1de602ddff140d91419e3f86dd35c81d7bd2d8e7
2025-11-02 14:12:22 +09:00
K.Takata f0feca1a84 [Bug #13671] Fix that "ss" in look-behind causes syntax error
Fixes k-takata/Onigmo#92.

This fix was ported from oniguruma:
https://github.com/kkos/oniguruma/commit/257082dac8c6019198b56324012f0bd1830ff4ba

https://github.com/k-takata/Onigmo/commit/b1a5445fbeba97b3e94a733c2ce11c033453af73
2025-11-02 14:11:36 +09:00
nagachika 30f661951b merge revision(s) 12350eb9e0: [Backport #21625]
[PATCH] [Bug #21625] Allow io/wait methods with `IO#ungetc` in text mode
2025-11-02 13:28:40 +09:00
nagachika 93828c4711 merge revision(s) 4368e6c42e:
[PATCH] [ruby/rubygems] Removed credential assertion from stdout

	https://github.com/ruby/rubygems/commit/3946be008c
2025-10-25 13:59:03 +09:00
nagachika e526fbe770 merge revision(s) e94a2f691d: [Backport #21638]
[PATCH] [Bug #21638] Mark ractor-local `$VERBOSE` and `$DEBUG`

	https://github.com/sampersand/blog/blob/master/the%20-s%20flag.md#the-segfault
2025-10-18 11:20:54 +09:00
nagachika 27a1df7506 merge revision(s) 7ae67e8f6a: [Backport #21568]
[PATCH] load.c: Fix dest and src of MEMMOVE

	When multiple files with the same name are required, the features_index
	hash stores the indexes in `$LOADED_FEATURES` array into a darray.
	The dest and src arguments for `MEMMOVE` were wrongly reversed when
	inserting a new index in the darray.

	[Bug #21568]
2025-10-11 17:01:06 +09:00
Bo Anderson ce7aa23f97 Update openssl gem to 3.2.2 2025-10-11 16:53:43 +09:00
Hiroshi SHIBATA 3fe7f490ff Merge URI-0.13.3 2025-10-09 23:08:48 +09:00
nagachika 05f93fe6dc merge revision(s) 62430c19c9: [Backport #21342]
Message not found for revision: 62430c19c9
2025-10-05 19:10:48 +09:00
nagachika 01b0beb818 merge revision(s) 928fea3bfa: [Backport #21567]
Fix crash when $LOADED_FEATURES is modified during require

	[Bug #21567]

	When we require an object that is not a string, it will attempt to convert
	it to a string by calling to_str on it. If we modify the $LOADED_FEATURES
	array while it calls to_str, Ruby can crash because it can end up inserting
	the string in the wrong index in the array.

	For example, the following script crashes:

	    require "tempfile"

	    class MyString
	      def initialize(path)
	        @path = path
	      end

	      def to_str
	        $LOADED_FEATURES.clear
	        @path
	      end

	      def to_path = @path
	    end

	    def create_ruby_file = Tempfile.create(["test", ".rb"]).path

	    require MyString.new(create_ruby_file)
	    $LOADED_FEATURES.unshift(create_ruby_file)
	    $LOADED_FEATURES << MyString.new(create_ruby_file)
	    require create_ruby_file

	Crash log:

	    test.rb:21: [BUG] Segmentation fault at 0x0000000000000004
	    ruby 3.5.0dev (2025-09-09T09:29:35Z master ce94add7fb) +PRISM [arm64-darwin24]

	    -- Crash Report log information --------------------------------------------
	      See Crash Report log file in one of the following locations:
	        * ~/Library/Logs/DiagnosticReports
	        * /Library/Logs/DiagnosticReports
	      for more details.
	    Don't forget to include the above Crash Report log file in bug reports.

	    -- Control frame information -----------------------------------------------
	    c:0003 p:---- s:0011 e:000010 CFUNC  :require
	    c:0002 p:0076 s:0006 e:000005 EVAL   test.rb:21 [FINISH]
	    c:0001 p:0000 s:0003 E:0001b0 DUMMY  [FINISH]

	    -- Ruby level backtrace information ----------------------------------------
	    test.rb:21:in '<main>'
	    test.rb:21:in 'require'

	    -- Threading information ---------------------------------------------------
	    Total ractor count: 1
	    Ruby thread count for this ractor: 1

	    -- Machine register context ------------------------------------------------
	      x0: 0x0000000000000004  x1: 0x000000000000c800  x2: 0x0000000000000000
	      x3: 0x0000000000000000  x4: 0x0000000000000205  x5: 0x0000000000000000
	      x6: 0x0000000000000000  x7: 0x0000000000000001 x18: 0x0000000000000000
	    x19: 0x0000000209dfc0b0 x20: 0x0000000209dfc018 x21: 0x000000016ee8ab58
	    x22: 0x0fffffff0009d71d x23: 0x0000000209dfc018 x24: 0x0000000209dfc150
	    x25: 0x000000016ee8acc0 x26: 0x0000000000000000 x27: 0x0000000000000000
	    x28: 0x0000000000000000  lr: 0x0000000101244140  fp: 0x000000016ee887f0
	      sp: 0x000000016ee887d0

	    -- C level backtrace information -------------------------------------------
	    miniruby(rb_print_backtrace+0x24) [0x101317b08] vm_dump.c:843
	    miniruby(rb_print_backtrace) (null):0
	    miniruby(rb_vm_bugreport+0x26c) [0x101317d94] vm_dump.c:1175
	    miniruby(rb_bug_for_fatal_signal+0xa4) [0x10105ddac] error.c:1130
	    miniruby(sig_do_nothing+0x0) [0x1012278c0] signal.c:948
	    miniruby(sigsegv) (null):0
	    /usr/lib/system/libsystem_platform.dylib(_sigtramp+0x38) [0x19c1216a4]
	    miniruby(rb_str_new_frozen+0x1c) [0x101244140] string.c:1495
	    miniruby(rb_check_realpath_internal+0x68) [0x101077804] file.c:4679
	    miniruby(rb_check_realpath+0x2c) [0x101077aa4] file.c:4765
	    miniruby(get_loaded_features_index+0x37c) [0x1010f9c94] load.c:467
	    miniruby(rb_feature_p+0xd0) [0x1010f8174] load.c:582
	    miniruby(search_required+0xac) [0x1010f6ad4] load.c:1193
	    miniruby(require_internal+0x274) [0x1010f7518] load.c:1424
	    miniruby(rb_require_string_internal+0x94) [0x1010f6830] load.c:1571
	    miniruby(rb_require_string+0x58) [0x1010f66e8] load.c:1557
	    miniruby(rb_f_require+0x1c) [0x1010f6684] load.c:1150
	    miniruby(ractor_safe_call_cfunc_1+0x38) [0x101306c28] vm_insnhelper.c:3696
	    miniruby(vm_call_cfunc_with_frame_+0x250) [0x1012f857c] vm_insnhelper.c:3873
	    miniruby(vm_call_cfunc_with_frame+0x6c) [0x1012f8834] vm_insnhelper.c:3919
	    miniruby(vm_sendish+0x1a8) [0x1012c990c] vm_insnhelper.c:6087
	    miniruby(vm_exec_core+0x4050) [0x1012cfb48] insns.def:900
	    miniruby(vm_exec_loop+0x80) [0x1012e5448] vm.c:2666
	    miniruby(rb_vm_exec+0x134) [0x1012c9b40] vm.c:2645
	    miniruby(rb_iseq_eval_main+0x34) [0x1012e5628] vm.c:2919
	    miniruby(rb_ec_exec_node+0xe4) [0x10106d094] eval.c:282
	    miniruby(ruby_run_node+0x94) [0x10106cf64] eval.c:320
	    miniruby(rb_main+0x40) [0x100f7499c] main.c:42
	    miniruby(main+0x60) [0x100f74928] main.c:62
2025-09-14 13:47:35 +09:00
nagachika e39a0a19c0 merge revision(s) ce849d565b, acb29f7fa1: [Backport #21402]
ruby2_keywords warnings: Quote non-UTF8 method names fully

	It used to quote only part of the method name because NUL byte in
	the method terminates the C string:

	```
	(irb)> "abcdef".encode("UTF-16LE").bytes
	=> [97, 0, 98, 0, 99, 0, 100, 0, 101, 0, 102, 0]
	```

	```
	expected: /abcdef/
	actual: warning: Skipping set of ruby2_keywords flag for a (method not defined in Ruby)\n".
	```

	Do not respect ruby2_keywords on method/proc with post arguments

	Previously, ruby2_keywords could be used on a method or proc with
	post arguments, but I don't think the behavior is desired:

	```ruby
	def a(*c, **kw) [c, kw] end
	def b(*a, b) a(*a, b) end
	ruby2_keywords(:b)

	b({foo: 1}, bar: 1)
	```

	This changes ruby2_keywords to emit a warning and not set the
	flag on a method/proc with post arguments.

	While here, fix the ruby2_keywords specs for warnings, since they
	weren't testing what they should be testing.  They all warned
	because the method didn't accept a rest argument, not because it
	accepted a keyword or keyword rest argument.
2025-09-14 12:47:12 +09:00
Hiroshi SHIBATA 1b6a5479de Backport GH-13617 for s390x (#13757) 2025-08-29 10:20:36 +09:00
nagachika 581be2b79c merge revision(s) 097d742a1e: [Backport #20009]
[Bug #20009] Support marshaling non-ASCII name class/module
2025-07-19 11:16:49 +09:00
3471ee0749 Fix generic_ivar_set_shape_ivptr for table rebuild
[Bug #21438]

Previously GC could trigger a table rebuild of the generic ivar
st_table in the middle of calling the st_update callback. This could
cause entries to be reallocated or rearranged and the update to be for
the wrong entry.

This commit adds an assertion to make that case easier to detect, and
replaces the st_update with a separate st_lookup and st_insert.

Also free after insert in generic_ivar_set_shape_ivptr

Previously we were performing a realloc and then inserting the new value
into the table. If the table was flagged as requiring a rebuild, this
could trigger GC work and marking within that GC could access the ivptr
freed by realloc.

Co-authored-by: Aaron Patterson <tenderlove@ruby-lang.org>
Co-authored-by: Jean Boussier <byroot@ruby-lang.org>
2025-07-19 10:23:17 +09:00
Hiroshi SHIBATA 111a49e77e Bump up resolv-0.3.1 for Ruby 3.3 2025-07-19 10:19:07 +09:00
Hiroshi SHIBATA 7fb19cf803 Partly picked from https://github.com/ruby/ruby/pull/10073 2025-07-02 11:05:40 +09:00
nagachika 1fb5ab411f merge revision(s) c1877d431e: [Backport #21437]
[ruby/date] [Bug #21437] Date#hash for large years

	Addresses https://bugs.ruby-lang.org/issues/21437

	Signed-off-by: Dmitry Dygalo <dmitry.dygalo@workato.com>

	https://github.com/ruby/date/commit/31f07bc576
2025-06-29 12:31:38 +09:00
nagachika a976792832 merge revision(s) 2e7e78cd59: [Backport #21440]
[Bug #21440] Stop caching member list in frozen Data/Struct class
2025-06-29 12:27:54 +09:00