Age | Commit message (Collapse) | Author |
|
Make use of the check in rb_alloc_tmp_buffer2.
https://hackerone.com/reports/1328463
When parsing cookies, only decode the values
Bump version
Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org>
Co-authored-by: Yusuke Endoh <mame@ruby-lang.org>
|
|
|
|
|
|
f367b4ffe739453e87e55f955138b0ce662942b7,31a757a4426f1ac8c479313e01542940386fc2fe,837cbea64b74d464bfbfb10e6c81a8f92c6eee71:
assert_equal accepts an expected value as the first argument
---
test/psych/test_coder.rb | 30 +++++++++++++++---------------
1 file changed, 15 insertions(+), 15 deletions(-)
Make the test pass with the old libyaml
I have no idea what result is right, but it fails with libyaml 0.1.7
(bundled with Ubuntu 18.04) anyway.
---
test/psych/test_coder.rb | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
test/psych/test_coder.rb: Suppress non-parenthesis warnings
http://rubyci.s3.amazonaws.com/debian9/ruby-master/log/20210518T093002Z.log.html.gz
```
/home/chkbuild/chkbuild/tmp/build/20210518T093002Z/ruby/test/psych/test_coder.rb:277: warning: ambiguity between regexp and two divisions: wrap regexp in parentheses or add a space after `/' operator
```
---
test/psych/test_coder.rb | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
|
|
5680c38c75aeb5cbd219aafa8eb48c315f287d97,f5d20411386ff2552ff27661387ddc4bae1ebc30: [Backport #17573]
Use valid `ec` for postponed job.
Postponed job can be registered from non-Ruby thread, which means
`ec` in TLS can be NULL. In this case, use main thread's `ec` instead.
See https://github.com/ruby/ruby/pull/4108
and https://github.com/ruby/ruby/pull/4336
---
vm_trace.c | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
Avoid assert failure when NULL EC is expected
After 5680c38c75aeb5cbd219aafa8eb48c315f287d97, postponed job APIs now
expect to be called on native threads not managed by Ruby and handles
getting a NULL execution context. However, in debug builds the change
runs into an assertion failure with GET_EC() which asserts that EC is
non-NULL. Avoid the assertion failure by passing `false` for `expect_ec`
instead as the intention is to handle when there is no EC.
Add a test from John Crepezzi and John Hawthorn to exercise this
situation.
See GH-4108
See GH-5094
[Bug #17573]
Co-authored-by: John Hawthorn <john@hawthorn.email>
Co-authored-by: John Crepezzi <john.crepezzi@gmail.com>
---
ext/-test-/postponed_job/postponed_job.c | 31 ++++++++++++++++++++++++++
test/-ext-/postponed_job/test_postponed_job.rb | 7 ++++++
vm_trace.c | 2 +-
3 files changed, 39 insertions(+), 1 deletion(-)
|
|
Delegate keywords from Enumerable#to_a to #each
Fixes [Bug #18289]
---
enum.c | 2 +-
test/ruby/test_enum.rb | 5 +++++
2 files changed, 6 insertions(+), 1 deletion(-)
|
|
[Bug #18329] Fix crash when calling non-existent super method
The cme is NULL when a method does not exist, so check it before
accessing the callcache.
---
test/ruby/test_super.rb | 31 +++++++++++++++++++++++++++++++
vm_insnhelper.c | 3 ++-
2 files changed, 33 insertions(+), 1 deletion(-)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Fixed FD leaks
---
test/socket/test_tcp.rb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
[Bug #18264] Fix memory leak in TracePoint
TracePoint leaks memory because it allocates a `rb_tp_t` struct
without ever freeing it (it is created with `RUBY_TYPED_NEVER_FREE`).
---
test/ruby/test_settracefunc.rb | 10 ++++++++++
vm_trace.c | 2 +-
2 files changed, 11 insertions(+), 1 deletion(-)
|
|
|
|
Bring the local copy of ruby/openssl in sync with the upstream gem
release v2.2.1. The commits happened in the upstream repository can be
found at:
https://github.com/ruby/openssl/compare/v2.2.0...v2.2.1
Note that many of these have already been applied to ruby.git and don't
appear in the file changes of this commit.
|
|
Dump outer variables tables when dumping an iseq to binary
This commit dumps the outer variables table when dumping an iseq to
binary. This fixes a case where Ractors aren't able to tell what outer
variables belong to a lambda after the lambda is loaded via ISeq.load_from_binary
[Bug #18232] [ruby-core:105504]
---
compile.c | 55 +++++++++++++++++++++++++++++++++++++++++++++++++-
test/ruby/test_iseq.rb | 10 +++++++++
2 files changed, 64 insertions(+), 1 deletion(-)
|
|
Avoid race condition in Regexp#match
In certain conditions, Regexp#match could return a MatchData with
missing captures. This seems to require at the least, multiple
threads calling a method that calls the same block/proc/lambda
which calls Regexp#match.
The race condition happens because the MatchData is passed from
indirectly via the backref, and other threads can modify the
backref.
Fix the issue by:
1. Not reusing the existing MatchData from the backref, and always
allocating a new MatchData.
2. Passing the MatchData directly to the caller using a VALUE*,
instead of indirectly through the backref.
It's likely that variants of this issue exist for other Regexp
methods. Anywhere that MatchData is passed implicitly through
the backref is probably vulnerable to this issue.
Fixes [Bug #17507]
---
re.c | 46 +++++++++++++++++++---------------------------
test/ruby/test_regexp.rb | 21 +++++++++++++++++++++
2 files changed, 40 insertions(+), 27 deletions(-)
|
|
60d0421ca861944459f52292d65dbf0ece26e38a,b6534691a16d751d59fc572d5dddebcaeb21f007,409dbc951b9875d27bd73748c88e15386473cffb,842b0008c132dd587f09766a228041afb7fed24f: [Backport #18191]
Fix the encoding of loaded feature names [Bug #18191]
The feature names loaded from the default load paths should also
be in the file system encoding.
---
ruby.c | 12 +++++++++++-
test/ruby/test_require.rb | 22 ++++++++++++++++++++++
2 files changed, 33 insertions(+), 1 deletion(-)
Copy path strings as interned strings
---
ruby.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
Replace expanded load path only when modified
---
ruby.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
Skip broken strings as the locale encoding
---
internal/string.h | 1 +
ruby.c | 11 +++++++----
string.c | 6 ++++++
3 files changed, 14 insertions(+), 4 deletions(-)
|
|
89242279e61b023a81c58065c62a82de8829d0b3,529fc204af84f825f98f83c34b004acbaa802615: [Backport #18141]
Marshal.load: do not call the proc until strings have their encoding
Ref: https://bugs.ruby-lang.org/issues/18141
---
marshal.c | 7 +++-
spec/ruby/core/marshal/shared/load.rb | 62 +++++++++++++++++++++++------------
test/ruby/test_marshal.rb | 17 ++++++++++
3 files changed, 64 insertions(+), 22 deletions(-)
marshal.c: don't call the proc with partially initialized objects.
(#4866)
For cyclic objects, it requires to keep a st_table of the partially
initialized objects.
---
marshal.c | 75 ++++++++++++++++++++---------------
spec/ruby/core/marshal/shared/load.rb | 75 ++++++++++++++++++++---------------
test/ruby/test_marshal.rb | 12 ++++++
3 files changed, 97 insertions(+), 65 deletions(-)
|
|
7c0230b05d0978958f89434c84ddd9c82419c1a5,552728a23aeab0df598b356b19a573259e297d14,49af9012a20a824542cf588e55e5488895553e09: [Backport #18184]
Check the entire name as `ruby2_keywords_flag` [Bug #18184]
---
marshal.c | 2 +-
test/ruby/test_marshal.rb | 8 +++++++-
2 files changed, 8 insertions(+), 2 deletions(-)
Check the encoding of `ruby2_keywords_flag` [Bug #18184]
---
marshal.c | 1 +
test/ruby/test_marshal.rb | 6 +++++-
2 files changed, 6 insertions(+), 1 deletion(-)
Prohibit invalid encoding symbols [Bug #18184]
---
marshal.c | 8 +++++++-
test/ruby/test_marshal.rb | 10 +++++++---
2 files changed, 14 insertions(+), 4 deletions(-)
|
|
[Bug #18173] Update loaded_features_index
If $LOADED_FEATURES is changed in the just required file, also the
index table needs to be updated before loaded_features_snapshot is
reset. If the snapshot is reset without updating the table, the
name of the added feature will not be found.
---
load.c | 1 +
test/ruby/test_require.rb | 17 +++++++++++++++++
2 files changed, 18 insertions(+)
|
|
If the thread termination invokes user code after `th->status` becomes
`THREAD_KILLED`, and the user unblock function causes that `th->status` to
become something else (e.g. `THREAD_RUNNING`), threads waiting in
`thread_join_sleep` will hang forever. We move the unblock function call
to before the thread status is updated, and allow threads to join as soon
as `th->value` becomes defined.
This reverts commit 6505c77501f1924571b2fe620c5c7b31ede0cd22.
|
|
|
|
|
|
* Wake up join list within thread EC context.
* Consume items from join list so that they are not re-executed.
If `rb_fiber_scheduler_unblock` raises an exception, it can result in a
segfault if `rb_threadptr_join_list_wakeup` is not within a valid EC. This
change moves `rb_threadptr_join_list_wakeup` into the thread's top level EC
which initially caused an infinite loop because on exception will retry. We
explicitly remove items from the thread's join list to avoid this situation.
* Verify the required scheduler interface.
* Test several scheduler hooks methods with broken `unblock` implementation.
|
|
Preserve the encoding of the argument in IndexError [Bug #18160]
---
re.c | 20 ++++++++++----------
test/ruby/test_regexp.rb | 7 ++++++-
2 files changed, 16 insertions(+), 11 deletions(-)
|
|
[ruby/strscan] Fix segmentation fault of `StringScanner#charpos` when
`String#byteslice` returns non string value [Bug #17756] (#20)
https://github.com/ruby/strscan/commit/92961cde2b
---
ext/strscan/strscan.c | 5 +----
test/strscan/test_stringscanner.rb | 17 +++++++++++++++++
2 files changed, 18 insertions(+), 4 deletions(-)
|
|
Check if closed after each yield [Bug #17661]
---
io.c | 4 +++-
test/ruby/test_io.rb | 36 ++++++++++++++++++++++++++++++++++++
2 files changed, 39 insertions(+), 1 deletion(-)
|
|
[Bug #18154] Fix memory leak in String#initialize
String#initialize can leak memory when called on a string that is marked
with STR_NOFREE because it does not unset the STR_NOFREE flag.
---
string.c | 2 +-
test/ruby/test_string.rb | 10 ++++++++++
2 files changed, 11 insertions(+), 1 deletion(-)
|
|
cd4f5b13228879d954fa97b6aa479c4a5ef4fb0a,8db269edb3550a85dfab9b193ea115ca36912ced,ab63f6d8543903f177c46634f38e5428655f003b: [Backport #18140]
Guard array when appending
This prevents early collection of the array. The GC doesn't see the
array on the stack when Ruby is compiled with optimizations enabled
[ruby-core:105099] [Bug #18140]
---
array.c | 1 +
test/ruby/test_array.rb | 6 ++++++
2 files changed, 7 insertions(+)
Guard array when appending
This prevents early collection of the array. The GC doesn't see the
array on the stack when Ruby is compiled with optimizations enabled
Thanks @jhaberman for the test case
[ruby-core:105099] [Bug #18140]
---
ext/-test-/array/concat/depend | 321 ++++++++++++++++++++++++++++++++
ext/-test-/array/concat/extconf.rb | 2 +
ext/-test-/array/concat/to_ary_conact.c | 64 +++++++
test/-ext-/array/test_to_ary_concat.rb | 20 ++
4 files changed, 407 insertions(+)
create mode 100644 ext/-test-/array/concat/depend
create mode 100644 ext/-test-/array/concat/extconf.rb
create mode 100644 ext/-test-/array/concat/to_ary_conact.c
create mode 100644 test/-ext-/array/test_to_ary_concat.rb
Refined test [Bug #18140]
---
ext/-test-/array/concat/to_ary_conact.c | 48 +++++++--------------------------
test/ruby/test_array.rb | 5 +++-
2 files changed, 13 insertions(+), 40 deletions(-)
|
|
Co-authored-by: nagachika <nagachika@ruby-lang.org>
|
|
d43279edacd09edf3a43e02d62f5be475e7c3bcb,5dc36ddcd00fc556c04c15ce9770c5a84d7d43dc,523bf31564f160f899f8cf9f73540d6a6f687f17: [Backport #18138]
Fix length calculation for Array#slice!
Commit 4f24255 introduced a bug which allows a length to be passed to
rb_ary_new4 which is too large, resulting in invalid memory access.
For example:
(1..1000).to_a.slice!(-2, 1000)
---
array.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Add out of range tests for Array#slice!
---
test/ruby/test_array.rb | 13 +++++++++++++
1 file changed, 13 insertions(+)
Add negative position tests [Bug #18138]
---
test/ruby/test_array.rb | 4 ++++
1 file changed, 4 insertions(+)
|
|
|
|
|
|
|
|
|
|
This fixes multiple bugs found in the partial backtrace
optimization added in 3b24b79.
These bugs occurs when passing a start argument to caller where
the start argument lands on a iseq frame without a pc.
Before this commit, the following code results in the same
line being printed twice, both for the #each method.
```
def a; [1].group_by { b } end
def b; puts(caller(2, 1).first, caller(3, 1).first) end
a
```
After this commit and in Ruby 2.7, the lines are different,
with the first line being for each and the second for group_by.
Before this commit, the following code can either segfault or
result in an infinite loop:
```
def foo
caller_locations(2, 1).inspect # segfault
caller_locations(2, 1)[0].path # infinite loop
end
1.times.map { 1.times.map { foo } }
```
After this commit, this code works correctly.
In terms of the implementation, this correctly skips iseq frames
without pc that occur before the number of frames the caller
requested to skip.
This rewrites the algorithm used for handling the partial
backtraces. It scans from the current frame outward to the
earliest frame, until it has found the desired number of frames.
It records that frame as the start frame. If needed, it continues
scanning backwards until arg->prev_cfp is set, as that is needed
to set the location of the first frame. Due to the fact that arg
is a void pointer, it's not possible to check this directly, but
this calls the iter_skip function in a situation where it knows
it will set arg->prev_cfp, and then breaks out of the loop.
Fixes [Bug #18053]
|
|
[Backport #17666]
Co-authored-by: Samuel Williams <@ioquatix>
https://github.com/nagachika/ruby/pull/1/commits/2cee515f024f3295945f312cb6b052f972f9c93d
|
|
391abc543cea118a9cd7d6310acadbfa352668ef,e86c1f6fc53433ef5c82ed2b7a4cc9a12c153e4c,f6539202c52a051a4e6946a318a1d9cd29002990: [Backport #12052]
Scan the coderange in the given encoding
---
ext/-test-/string/enc_str_buf_cat.c | 14 ++++++++++++++
string.c | 32 ++++++++++++++++++++++---------
test/-ext-/string/test_enc_str_buf_cat.rb | 9 +++++++++
3 files changed, 46 insertions(+), 9 deletions(-)
Work around issue transcoding issue with non-ASCII compatible
encodings and xml escaping
When using a non-ASCII compatible source and destination encoding
and xml escaping (the :xml option to String#encode), the resulting
string was broken, as it used the correct non-ASCII compatible
encoding, but contained data that was ASCII-compatible instead of
compatible with the string's encoding.
Work around this issue by detecting the case where both the
source and destination encoding are non-ASCII compatible, and
transcoding the source string from the non-ASCII compatible
encoding to UTF-8. The xml escaping code will correctly handle
the UTF-8 source string and the return the correctly encoded
and escaped value.
Fixes [Bug #12052]
Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org>
---
test/ruby/test_transcode.rb | 19 +++++++++++++++++++
transcode.c | 6 ++++++
2 files changed, 25 insertions(+)
=?UTF-8?q?-=20add=20regression=20tests=20for=20U+6E7F=20(?=
=?UTF-8?q?=E6=B9=BF)=20in=20ISO-2022-JP?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
In ISO-2022-JP, the bytes use to code are the same as those for "<>".
This adds regression tests to make sure that these bytes, when representing
湿, are NOT escaped with encode("ISO-2022-JP, xml: :text) or similar.
These are additional regression tests for #12052.
---
test/ruby/test_transcode.rb | 3 +++
1 file changed, 3 insertions(+)
|
|
skip marking for uninitialized imemo_env.
RUBY_INTERNAL_EVENT_NEWOBJ can expose uninitialized imemo_env
objects and marking it will cause critical error. This patch
skips marking on uninitialized imemo_env.
See: http://rubyci.s3.amazonaws.com/centos7/ruby-master/log/20210329T183003Z.fail.html.gz
Shortest repro-code is provided by mame-san.
---
gc.c | 16 ++++++++++------
test/objspace/test_objspace.rb | 13 +++++++++++++
2 files changed, 23 insertions(+), 6 deletions(-)
|
|
This fixes CVE-2021-32066.
Reported by Alexandr Savca in <https://hackerone.com/reports/1178562>.
|