Граф коммитов

74234 Коммитов

Автор SHA1 Сообщение Дата
Takashi Kokubun b7644a2311
YJIT: GC and recompile all code pages (#6406)
when it fails to allocate a new page.

Co-authored-by: Alan Wu <alansi.xingwu@shopify.com>
2022-10-25 09:07:10 -07:00
Yusuke Endoh 1d2d25dcad Prevent potential buffer overrun in onigmo
A code pattern `p + enclen(enc, p, pend)` may lead to a buffer overrun
if incomplete bytes of a UTF-8 character is placed at the end of a
string. Because this pattern is used in several places in onigmo,
this change fixes the issue in the side of `enclen`: the function should
not return a number that is larger than `pend - p`.

Co-Authored-By: Nobuyoshi Nakada <nobu@ruby-lang.org>
2022-10-25 17:02:43 +09:00
Nobuyoshi Nakada 114e71d062 [ruby/tmpdir] Ignore empty environment variables
Fixes https://github.com/ruby/tmpdir/pull/17

https://github.com/ruby/tmpdir/commit/a79c727a5d
2022-10-25 07:54:40 +00:00
Nobuyoshi Nakada 883d9c305f [ruby/tmpdir] Found or raise 2022-10-25 07:16:36 +00:00
Nobuyoshi Nakada d55f72bcdb [ruby/tmpdir] Update supported and testing ruby versions 2022-10-25 06:59:30 +00:00
Peter Vandenberk 287c5da4aa [ruby/tmpdir] Make `Dir.tmpdir` more idiomatic and functional
Use `Enumerable#find` to iterate over the candidates, not `Enumerable.each`.

(this makes the code more functional, and - IMO - slightly more idiomatic,
as it avoids setting the "global" (by which I mean: non-local) `tmp`
variable from inside the block)

https://github.com/ruby/tmpdir/commit/d1f20ad694
2022-10-25 06:59:16 +00:00
dependabot[bot] ba15fb709b [rubygems/rubygems] Bump rb-sys in /test/rubygems/test_gem_ext_cargo_builder/custom_name
Bumps [rb-sys](https://github.com/oxidize-rb/rb-sys) from 0.9.31 to 0.9.34.
- [Release notes](https://github.com/oxidize-rb/rb-sys/releases)
- [Commits](https://github.com/oxidize-rb/rb-sys/compare/v0.9.31...v0.9.34)

---
updated-dependencies:
- dependency-name: rb-sys
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

https://github.com/rubygems/rubygems/commit/6af714b02c
2022-10-25 06:56:59 +00:00
Nobuyoshi Nakada cade3aba61 [ruby/tmpdir] Fix typo 2022-10-25 05:02:54 +00:00
Nobuyoshi Nakada 71a5b1d457
[ruby/tmpdir] [DOC] Improve documentation
https://github.com/ruby/tmpdir/commit/b9c880f2b6
2022-10-25 13:57:56 +09:00
Nobuyoshi Nakada d76284dfb7
sync_default_gems.rb: Ignore unmergeable files [ci skip] 2022-10-25 13:52:53 +09:00
Yusuke Endoh 902e459b73
Prevent buffer overrun in regparse.c
A regexp that ends with an escape following an incomplete UTF-8 char
might cause buffer overrun. Found by OSS-Fuzz.

```
$ valgrind ./miniruby -e 'Regexp.new("\\u2d73\\0\\0\\0\\0          \\\xE6".b)'
==296213== Memcheck, a memory error detector
==296213== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==296213== Using Valgrind-3.18.1 and LibVEX; rerun with -h for copyright info
==296213== Command: ./miniruby -e Regexp.new("\\\\u2d73\\\\0\\\\0\\\\0\\\\0\ \ \ \ \ \ \ \ \ \ \\\\\\xE6".b)
==296213==
==296213== Warning: client switching stacks?  SP change: 0x1ffe8020e0 --> 0x1ffeffff10
==296213==          to suppress, use: --max-stackframe=8379952 or greater
==296213== Invalid read of size 1
==296213==    at 0x484EA10: memmove (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==296213==    by 0x339568: memcpy (string_fortified.h:29)
==296213==    by 0x339568: onig_strcpy (regparse.c:271)
==296213==    by 0x339568: onig_node_str_cat (regparse.c:1413)
==296213==    by 0x33CBA0: parse_exp (regparse.c:6198)
==296213==    by 0x33EDE4: parse_branch (regparse.c:6511)
==296213==    by 0x33EEA2: parse_subexp (regparse.c:6544)
==296213==    by 0x34019C: parse_regexp (regparse.c:6593)
==296213==    by 0x34019C: onig_parse_make_tree (regparse.c:6638)
==296213==    by 0x32782D: onig_compile_ruby (regcomp.c:5779)
==296213==    by 0x313EFA: onig_new_with_source (re.c:876)
==296213==    by 0x313EFA: make_regexp (re.c:900)
==296213==    by 0x313EFA: rb_reg_initialize (re.c:3136)
==296213==    by 0x318555: rb_reg_initialize_str (re.c:3170)
==296213==    by 0x318555: rb_reg_init_str (re.c:3205)
==296213==    by 0x31A669: rb_reg_initialize_m (re.c:3856)
==296213==    by 0x3E5165: vm_call0_cfunc_with_frame (vm_eval.c:150)
==296213==    by 0x3E5165: vm_call0_cfunc (vm_eval.c:164)
==296213==    by 0x3E5165: vm_call0_body (vm_eval.c:210)
==296213==    by 0x3E89BD: vm_call0_cc (vm_eval.c:87)
==296213==    by 0x3E89BD: rb_call0 (vm_eval.c:551)
==296213==  Address 0x9d45b10 is 0 bytes after a block of size 32 alloc'd
==296213==    at 0x4844899: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==296213==    by 0x20FA7B: objspace_xmalloc0 (gc.c:12146)
==296213==    by 0x35F8C9: str_buf_cat4.part.0 (string.c:3132)
==296213==    by 0x31359D: unescape_escaped_nonascii (re.c:2690)
==296213==    by 0x313A9D: unescape_nonascii (re.c:2869)
==296213==    by 0x313A9D: rb_reg_preprocess (re.c:2992)
==296213==    by 0x313DFC: rb_reg_initialize (re.c:3109)
==296213==    by 0x318555: rb_reg_initialize_str (re.c:3170)
==296213==    by 0x318555: rb_reg_init_str (re.c:3205)
==296213==    by 0x31A669: rb_reg_initialize_m (re.c:3856)
==296213==    by 0x3E5165: vm_call0_cfunc_with_frame (vm_eval.c:150)
==296213==    by 0x3E5165: vm_call0_cfunc (vm_eval.c:164)
==296213==    by 0x3E5165: vm_call0_body (vm_eval.c:210)
==296213==    by 0x3E89BD: vm_call0_cc (vm_eval.c:87)
==296213==    by 0x3E89BD: rb_call0 (vm_eval.c:551)
==296213==    by 0x3E957B: rb_call (vm_eval.c:877)
==296213==    by 0x3E957B: rb_funcallv_kw (vm_eval.c:1074)
==296213==    by 0x2A4123: rb_class_new_instance_pass_kw (object.c:1991)
==296213==
==296213==
==296213== HEAP SUMMARY:
==296213==     in use at exit: 35,476,538 bytes in 9,489 blocks
==296213==   total heap usage: 14,893 allocs, 5,404 frees, 37,517,821 bytes allocated
==296213==
==296213== LEAK SUMMARY:
==296213==    definitely lost: 316,081 bytes in 2,989 blocks
==296213==    indirectly lost: 136,808 bytes in 2,361 blocks
==296213==      possibly lost: 1,048,624 bytes in 3 blocks
==296213==    still reachable: 33,975,025 bytes in 4,136 blocks
==296213==         suppressed: 0 bytes in 0 blocks
==296213== Rerun with --leak-check=full to see details of leaked memory
==296213==
==296213== For lists of detected and suppressed errors, rerun with: -s
==296213== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)
```
2022-10-25 13:20:25 +09:00
Nick Hengeveld ee3da3784e Use CXX14 to allow constexpr with non-return statements
Co-authored-by: Daniel Colson <composerinteralia@github.com>
2022-10-24 16:47:42 -07:00
dependabot[bot] fcb1a49812 [rubygems/rubygems] Bump rb-sys
Bumps [rb-sys](https://github.com/oxidize-rb/rb-sys) from 0.9.31 to 0.9.34.
- [Release notes](https://github.com/oxidize-rb/rb-sys/releases)
- [Commits](https://github.com/oxidize-rb/rb-sys/compare/v0.9.31...v0.9.34)

---
updated-dependencies:
- dependency-name: rb-sys
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

https://github.com/rubygems/rubygems/commit/1882ad876f
2022-10-24 23:33:53 +00:00
John Hawthorn b652dbf63b Remove iv_index_tbl_entry 2022-10-24 10:54:01 -07:00
Stan Lo abeef41c95 [ruby/irb] Restore standard input/output encodings after input method tests 2022-10-24 17:02:34 +00:00
Takashi Kokubun 120b747b7d
YJIT: Lazily enable YJIT after prelude (#6597)
* YJIT: Lazily enable YJIT after prelude

* Update dependencies

* Use a bit field for opt->yjit
2022-10-24 12:20:44 -04:00
Burdette Lamar 841be6392e
[DOC] Revert previous merge (#6624)
Revert previous merge
2022-10-24 10:38:19 -05:00
Nobuyoshi Nakada 21fa0135a4
Split tests for `Array#shuffle` and `Array#sample` 2022-10-24 23:45:45 +09:00
Burdette Lamar bcb72f503c
[DOC] Add note about method names (#6620) 2022-10-24 08:56:13 -05:00
st0012 5a86155249 [ruby/irb] Add a test case to cover rdoc unintalled scenario 2022-10-24 13:36:58 +00:00
st0012 b7622d792d [ruby/irb] Move require out of repeated execution path
SHOW_DOC_DIALOG will be called repeatedly whenever the corresponding key
is pressed, but we only need to require rdoc once. So ideally the
require can be put outside of the proc.

And because when rdoc is not available the entire proc will be
nonfunctional, we can stop registering the SHOW_DOC_DIALOG if we failed
to require rdoc.

https://github.com/ruby/irb/commit/b1278b7320
2022-10-24 13:36:57 +00:00
st0012 d377cc4530 [ruby/irb] Add tests for RelineInputMethod 2022-10-24 13:36:56 +00:00
Nobuyoshi Nakada 6cca8a0ceb
Strip trailing spaces [ci skip] 2022-10-24 18:38:09 +09:00
git c7a5ca999e * remove trailing spaces. [ci skip] 2022-10-24 09:28:07 +00:00
git 399747926c Update bundled gems list at 2022-10-24 2022-10-24 09:27:55 +00:00
Yusuke Endoh 67ed70da61 Refactor timeout-setting code to a function 2022-10-24 18:21:30 +09:00
Yusuke Endoh ef01482f64 Refactor timeout-related code in re.c a little 2022-10-24 18:13:26 +09:00
Nobuyoshi Nakada 8873c420d3
Fix error when commit hash is removed [ci skip] 2022-10-24 18:12:25 +09:00
Yusuke Endoh b51b22513f
Fix per-instance Regexp timeout (#6621)
Fix per-instance Regexp timeout

This makes it follow what was decided in [Bug #19055]:

* `Regexp.new(str, timeout: nil)` should respect the global timeout
* `Regexp.new(str, timeout: huge_val)` should use the maximum value that
  can be represented in the internal representation
* `Regexp.new(str, timeout: 0 or negative value)` should raise an error
2022-10-24 18:03:26 +09:00
Nobuyoshi Nakada 6700fa7f62
Set timestamp path for the target path to TARGET_SO_DIR_TIMESTAMP 2022-10-24 17:48:00 +09:00
Nobuyoshi Nakada 711b2ed5fe
Make the timestamp path correspond to the bundled target path
So different timestamps for different paths will be used.  Extentions
paths in bundled gems contain `ruby_version`, which includes the ABI
version, and the same timestamp file for different paths resulted in
build failures when it changed.
2022-10-24 17:47:59 +09:00
Nobuyoshi Nakada 3af373285b
Adjust indents [ci skip] 2022-10-24 17:42:29 +09:00
S-H-GAMELINKS 298221dfe5 Reuse RBOOL macro in rb_ivar_defined function 2022-10-24 10:25:01 +02:00
git 87f432b675 Update default gems list at c5f5403f6e [ci skip] 2022-10-24 05:46:26 +00:00
Hiroshi SHIBATA c5f5403f6e [ruby/net-http] Bump version to 0.3.0 2022-10-24 05:45:44 +00:00
Nobuyoshi Nakada 174ddc79c5
Skip `File.atime`/`File.mtime` tests randomly failing on Travis
Not only powerpc64le, also s390x and arm32 seem failing too.  These
failures are probably caused by filesystem settings on Travis, but
unrelated to CPUs.
2022-10-24 09:32:13 +09:00
Nobuyoshi Nakada c3e37f74ae
Adjust indents [ci skip] 2022-10-24 00:22:37 +09:00
S-H-GAMELINKS c4089e6524 Fix argument & Remove enum 2022-10-23 17:38:59 +09:00
S-H-GAMELINKS 1e06ef1328 Introduce rb_memsearch_with_char_size function 2022-10-23 17:38:59 +09:00
Nobuyoshi Nakada 86450d03a8 Reduce type check of arguments at Complex creation 2022-10-23 16:44:43 +09:00
S.H c8c136265c
Introduce `hash_iter_status_check` function 2022-10-23 16:17:24 +09:00
Stephen Ierodiaconou 54cad3123a
[Bug #19004] `Complex.polar` handles complex singular `abs` argument
`Complex.polar` accepts Complex values as arguments for the polar form as long
as the value of the complex has no imaginary part (ie it is 'real'). In
`f_complex_polar` this is handled by extracting the real part of the arguments.
However in the case `polar` is called with only a single argument, the absolute
value (abs), then the Complex is created without applying a check on the type
of abs, meaning it is possible to create a Complex where the real part is itself
an instance of a Complex. This change removes the short circuit for the single
argument case meaning the real part extraction is performed correctly
(by f_complex_polar).

Also adds an example to `spec/ruby/core/complex/polar_spec.rb` to check that
the real part of a complex argument is correctly extracted and used in the
resulting Complex real and imaginary parts.
2022-10-23 12:59:06 +09:00
Nobuyoshi Nakada 0d9628e0de
Update Complex.polar with Complex tests 2022-10-23 12:46:13 +09:00
Samuel Williams 8dfe3bdf48
Improved formatting of `hash_foreach_iter` functions. (#6615) 2022-10-22 23:34:00 +13:00
Thomas E. Enebo 420bdba139 [rubygems/rubygems] Allow upcoming JRuby to pass keywords for Kernel#warn
jruby-head (which will be JRuby 9.4.0.0) can now properly process
the keywords to Kernel#warn.  I cannot think of any capability based
test for this so I constrained it using a version guard.  Only JRuby
will ever hit the version guard.

https://github.com/rubygems/rubygems/commit/cd468c7e0f
2022-10-22 08:01:24 +00:00
yui-knk 0d697e341a Add [Feature #19013] to NEWS [ci skip] 2022-10-22 16:46:27 +09:00
Jemma Issroff a11952dac1 Rename `iv_count` on shapes to `next_iv_index`
`iv_count` is a misleading name because when IVs are unset, the new
shape doesn't decrement this value. `next_iv_count` is an accurate, and
more descriptive name.
2022-10-21 14:57:34 -07:00
Jemma Issroff 13bd617ea6 Remove unused class serial
Before object shapes, we were using class serial to invalidate
inline caches. Now that we use shape_id for inline cache keys,
the class serial is unnecessary.

Co-Authored-By: Aaron Patterson <tenderlove@ruby-lang.org>
2022-10-21 14:56:48 -07:00
Alan Wu 87bb0bee6b
YJIT: Fix page rounding for icache busting
Previously, we found the current page by rounding the current pointer to
the closest smaller page size. This is incorrect because pages are
relative to the start of the address we reserve. For example, if the
starting address is 12KiB modulo the 16KiB page size, once we have more
than 4KiB of code, calculating with the address would incorrectly give
us page 1 when we're actually still on page 0.

Previously, I can reproduce crashes with:

    make btest RUN_OPTS=--yjit-code-page-size=32

on ARM64 macOS, where system page sizes are 16KiB.
2022-10-21 17:06:34 -04:00
Alan Wu 8bbcb75377 YJIT: Read rb_num_t as usize early
This patch makes sure that we're not accidentally reading rb_num_t
instruction arguments as VALUE and accidentally baking them into
code and marking them. Some of these are simply moving the cast earlier,
but some of these avoid potential problems for flag and ID arguments.

Follow-up for 39f7eddec4.
2022-10-21 16:25:41 -04:00