Age | Commit message (Collapse) | Author |
|
the correct use of proc argument.
https://github.com/ruby/json/commit/92654cd99b
|
|
when passing proc to JSON.unsafe_load, matching the changes made in
https://github.com/ruby/json/commit/73d2137fd3ad.
https://github.com/ruby/json/commit/77292cbc9b
|
|
Fix: https://github.com/ruby/json/pull/843
https://github.com/ruby/json/commit/d3f7f0452b
Co-Authored-By: Takashi Kokubun <takashikkbn@gmail.com>
|
|
TestTracepointObj#test_teardown_with_active_GC_end_hook was failing on
some platforms due to a Proc that is not marked being passed around.
Neither rb_tracepoint_new() nor rb_postponed_job_preregister() promise
to mark their callback `void *data`.
https://rubyci.s3.amazonaws.com/osx1300arm/ruby-master/log/20250902T154504Z.fail.html.gz
Add a GC.start to make the test a better detector for this safety issue
and fix it by getting the Proc from an ivar on the rooted module.
|
|
The embed layout is way more common than the heap one,
especially since WVA.
I think it makes for more readable code to inverse the
flag.
|
|
Because both strings and symbols keys are serialized the same,
it always has been possible to generate documents with duplicated
keys:
```ruby
>> puts JSON.generate({ foo: 1, "foo" => 2 })
{"foo":1,"foo":2}
```
This is pretty much always a mistake and can cause various
issues because it's not guaranteed how various JSON parsers
will handle this.
Until now I didn't think it was possible to catch such case without
tanking performance, hence why I only made the parser more strict.
But I finally found a way to check for duplicated keys cheaply enough.
|
|
|
|
|
|
https://github.com/ruby/json/commit/3187c88c06
|
|
https://github.com/ruby/json/commit/19bcfdd8d8
|
|
Helps with pretty printting performance:
```
== Encoding activitypub.json (52595 bytes)
ruby 3.4.2 (2025-02-15 revision https://github.com/ruby/json/commit/d2930f8e7a) +YJIT +PRISM [arm64-darwin24]
Warming up --------------------------------------
after 1.746k i/100ms
Calculating -------------------------------------
after 17.481k (± 1.0%) i/s (57.20 μs/i) - 89.046k in 5.094341s
Comparison:
before: 16038.4 i/s
after: 17481.1 i/s - 1.09x faster
== Encoding citm_catalog.json (500298 bytes)
ruby 3.4.2 (2025-02-15 revision https://github.com/ruby/json/commit/d2930f8e7a) +YJIT +PRISM [arm64-darwin24]
Warming up --------------------------------------
after 60.000 i/100ms
Calculating -------------------------------------
after 608.157 (± 2.3%) i/s (1.64 ms/i) - 3.060k in 5.034238s
Comparison:
before: 525.3 i/s
after: 608.2 i/s - 1.16x faster
== Encoding twitter.json (466906 bytes)
ruby 3.4.2 (2025-02-15 revision https://github.com/ruby/json/commit/d2930f8e7a) +YJIT +PRISM [arm64-darwin24]
Warming up --------------------------------------
after 160.000 i/100ms
Calculating -------------------------------------
after 1.606k (± 0.5%) i/s (622.70 μs/i) - 8.160k in 5.081406s
Comparison:
before: 1410.3 i/s
after: 1605.9 i/s - 1.14x faster
```
https://github.com/ruby/json/commit/f0dda861c5
|
|
https://github.com/ruby/json/commit/2d63648c0a
|
|
https://github.com/ruby/json/commit/12656777dc
|
|
Similar to 19f3793a4bd6974cd66cc058fc6d2ae733337745
Fixes:
```
../../../ext/socket/raddrinfo.c:755:60: warning: implicit conversion loses integer precision: 'size_t' (aka 'unsigned long') to 'socklen_t' (aka 'unsigned int') [-Wshorten-64-to-32]
755 | return getnameinfo(sa, salen, host, hostlen, serv, servlen, flags);
| ~~~~~~~~~~~ ^~~~~~~
../../../ext/socket/raddrinfo.c:755:45: warning: implicit conversion loses integer precision: 'size_t' (aka 'unsigned long') to 'socklen_t' (aka 'unsigned int') [-Wshorten-64-to-32]
755 | return getnameinfo(sa, salen, host, hostlen, serv, servlen, flags);
| ~~~~~~~~~~~ ^~~~~~~
```
|
|
|
|
When calling getnameinfo we spawn a thread because it may do a slow,
blocking reverse-DNS lookup. Spawning a thread is relatively fast (~20µs
on my Linux machine) but still an order of magnitude slower than when
getnameinfo is simply translating to a numeric IP or port, which, at
least in my tests on Linux, doesn't even make a syscall.
This commit adds a fast path for when reverse DNS isn't required: either
host isn't being fetched or NI_NUMERICHOST is set AND either the
service name isn't required or NI_NUMERICSERV is set. The service name
should only need to read /etc/services, which should be fast-ish, but
is still I/O so I kept the existing behaviour (it could be on a network
fs I guess).
I tested with:
s = TCPSocket.open("www.ruby-lang.org", 80)
500_000.times { Socket.unpack_sockaddr_in(s.getpeername) }
Before: 12.935s
After: 0.338s
|
|
Both the X509 store and X509 store context were missing write barriers.
To the callback object being stored in the ex data.
These values were also being stored as an IV, however in Ruby HEAD we're
now storing the IVs for T_DATA (generic IVs) on a separate object. So we
need an additional write barrier.
I believe this was always necessary, because we could have done
incremental marking ahead of compaction, and without the write barrier
the mark function could have been run before @verify_callback was
assigned.
This was detected by wbcheck
https://github.com/ruby/openssl/commit/1fda3a99ef
|
|
|
|
https://github.com/ruby/json/commit/72e231f929
|
|
https://github.com/ruby/json/commit/2d2e0d403d
|
|
On 32-bit Cygwin at least, it was failing to find that function,
presumably due to it being stdcall.
Signed-off-by: Jeremy Drake <github@jdrake.com>
https://github.com/ruby/resolv/commit/bceafef74b
|
|
https://github.com/ruby/stringio/commit/ac6292c17f
|
|
https://github.com/ruby/stringio/commit/113dd5a55e
|
|
on null device
(https://github.com/ruby/stringio/pull/137)
Fixes segmentation fault when calling `seek` with `SEEK_END` on null
device StringIO created by
`StringIO.new(nil)`.
```bash
ruby -e "require 'stringio'; StringIO.new(nil).seek(0, IO::SEEK_END)"
```
I tested with below versions.
```bash
[koh@Kohs-MacBook-Pro] ~
% ruby -v;gem info stringio;sw_vers
ruby 3.4.5 (2025-07-16 revision https://github.com/ruby/stringio/commit/20cda200d3) +PRISM [arm64-darwin24]
*** LOCAL GEMS ***
stringio (3.1.2)
Authors: Nobu Nakada, Charles Oliver Nutter
Homepage: https://github.com/ruby/stringio
Licenses: Ruby, BSD-2-Clause
Installed at (default): /Users/koh/.local/share/mise/installs/ruby/3.4.5/lib/ruby/gems/3.4.0
Pseudo IO on String
ProductName: macOS
ProductVersion: 15.5
BuildVersion: 24F74
[koh@Kohs-MacBook-Pro] ~
%
```
https://github.com/ruby/stringio/commit/9399747bf9
|
|
|
|
All the `json/add` related methods for string were
always defined unconditionally from the generators.
It's preferable to only define them if `json/add` is actually used.
|
|
Add a simple test case that creates an enveloped-data structure without
using the shorthand method, and fix two issues preventing this from
working correctly.
First, OpenSSL::PKey::PKCS7#add_recipient currently inserts an
incomplete PKCS7_RECIP_INFO object into the PKCS7 object. When
duplicating an unfinalized PKCS7_RECIP_INFO, the internal X509 reference
must also be copied, as it is later used by #add_data to fill the rest.
A similar issue with #add_signer was fixed in commit https://github.com/ruby/openssl/commit/20ca7a27a86e
(pkcs7: keep private key when duplicating PKCS7_SIGNER_INFO,
2021-03-24).
Second, #add_data calls PKCS7_dataFinal(), which for enveloped-data
appears to require the BIO to be flushed explicitly with BIO_flush().
Without this, the last block of the encrypted data would be missing.
https://github.com/ruby/openssl/commit/9595ecf643
|
|
Raise an exception right after an OpenSSL function returns an error.
Checking ERR_peek_error() is not reliable way to see if an error has
occurred or not, as OpenSSL functions do not always populate the error
queue.
https://github.com/ruby/openssl/commit/cc3f1af73e
|
|
Only call PKCS7_get_detached() if the PKCS7 object is a signed-data.
This is only useful for the content type, and leaves an error entry if
called on a PKCS7 object with a different content type.
https://github.com/ruby/openssl/commit/8997f6d5e6
|
|
`RSHAPE_PARENT` is error prone because it returns a raw untagged
shape_id.
To check if a shape is a direct parent of another, tags should be
discarded. So providing a comparison function is better than exposing
untagged ids.
|
|
Set the error_string attribute to nil if PKCS7_verify() succeeds, since
the error queue should be empty in that case.
With AWS-LC, OpenSSL::PKCS#verify currently sets error_string to
"invalid library (0)" when the verification succeeds, whereas with
OpenSSL and LibreSSL, it becomes nil. ERR_reason_error_string() appears
to behave differently when an invalid error code is passed.
The branch to raise OpenSSL::PKCS7::PKCS7Error is removed because it
does not appear to be reachable.
https://github.com/ruby/openssl/commit/c11c6631fa
|
|
ossl_x509{,attr,crl,ext,revoked,name}*_new(NULL)"
This reverts commit ec01cd9bbbaf3e6f324e0a6769b8383857d2bc07.
This should no longer break the tests, now that the following changes
have been applied:
- RubyGems change: 32977f3869ba1c44950f484ddbf3a12889c0b20b
- ruby/openssl change: e8261963c79ba61453f7f0dae281c33a1287b351
|
|
Commit https://github.com/ruby/openssl/commit/ef277083ba76 overlooked a caller of ossl_x509_new() with NULL
argument. OpenSSL::X509::StoreContext#current_cert may not have a
certificate to return if StoreContext#verify has not been called.
https://github.com/ruby/openssl/commit/4149b43890
|
|
It has been marked as obsolete for a while and I see no reason
to keep it.
|
|
Visual C:
```
compiling ../../../../../src/ext/-test-/namespace/yay1/yay1.c
yay1.c
../../../../../src/ext/-test-/namespace/yay1/yay1.c(4): warning C4273: 'yay_value': inconsistent dll linkage
C:\a\ruby\ruby\src\ext\-test-\namespace\yay1\yay1.h(4): note: see previous definition of 'yay_value'
linking shared-object -test-/namespace/yay1.so
Creating library yay1-arm64-mswin64_140.lib and object yay1-arm64-mswin64_140.exp
yay1-arm64-mswin64_140.exp : warning LNK4070: /OUT:yay1.dll directive in .EXP differs from output filename '..\..\..\..\.ext\arm64-mswin64_140\-test-\namespace\yay1.so'; ignoring directive
compiling ../../../../../src/ext/-test-/namespace/yay2/yay2.c
yay2.c
../../../../../src/ext/-test-/namespace/yay2/yay2.c(4): warning C4273: 'yay_value': inconsistent dll linkage
C:\a\ruby\ruby\src\ext\-test-\namespace\yay2\yay2.h(4): note: see previous definition of 'yay_value'
linking shared-object -test-/namespace/yay2.so
Creating library yay2-arm64-mswin64_140.lib and object yay2-arm64-mswin64_140.exp
yay2-arm64-mswin64_140.exp : warning LNK4070: /OUT:yay2.dll directive in .EXP differs from output filename '..\..\..\..\.ext\arm64-mswin64_140\-test-\namespace\yay2.so'; ignoring directive
```
From MinGW gcc:
```
../../../../../src/ext/-test-/namespace/yay1/yay1.c:4:1: warning: 'yay_value' redeclared without dllimport attribute: previous dllimport ignored [-Wattributes]
4 | yay_value(void)
| ^~~~~~~~~
../../../../../src/ext/-test-/namespace/yay2/yay2.c:4:1: warning: 'yay_value' redeclared without dllimport attribute: previous dllimport ignored [-Wattributes]
4 | yay_value(void)
| ^~~~~~~~~
```
|
|
https://github.com/ruby/json/commit/9e3efbfa22
|
|
https://github.com/ruby/json/commit/132049bde2
|
|
Followup: https://github.com/ruby/json/pull/818
Now the warning should point at the `JSON.parse` caller, and not
inside the json gem itself.
https://github.com/ruby/json/commit/cd51557387
|
|
Followup: https://github.com/ruby/json/pull/818
https://github.com/ruby/json/commit/e3de4cc59c
|
|
ossl_x509{,attr,crl,ext,revoked,name}*_new(NULL)"
This reverts commit 4e8bbb07dd4936b97a6b39d54a6977a107518e1f.
It broke RubyGems tests:
https://rubyci.s3.amazonaws.com/debian/ruby-master/log/20250727T123003Z.fail.html.gz
OpenSSL::X509::StoreContext#current_cert incorrectly calls
ossl_x509_new() with NULL to create a bogus Certificate object, and a
test case in RubyGems relies on it. This will be reapplied when both
are fixed.
|
|
Among functions named ossl_*_new(), ossl_pkey_new() is now the only one
that takes ownership of the passed OpenSSL object instead of making a
copy or incrementing its reference counter. Rename it to make this
behavior easier to understand.
https://github.com/ruby/openssl/commit/54c1c26eb5
|
|
Likewise, let it take a const pointer and not the ownership of the
OpenSSL object.
This fixes potential memory leak in OpenSSL::OCSP::BasicResponse#status.
https://github.com/ruby/openssl/commit/7e0288ebbd
|
|
Similar to most of the other ossl_*_new() functions, let it take a const
pointer and make a copy of the object.
This also fixes a potential memory leak when the wrapper object
allocation fails.
https://github.com/ruby/openssl/commit/eaabf6d8a3
|
|
These functions are not actually called with NULL.
https://github.com/ruby/openssl/commit/c089301e56
|
|
These functions are not actually called with NULL. It also doesn't make
sense to do so, so let's simplify the definitions.
https://github.com/ruby/openssl/commit/ef277083ba
|
|
Currently, calling ossl_bn_new() with a NULL argument allocates a new
OpenSSL::BN instance representing 0. This behavior is confusing. Raise
an exception if this is attempted, instead.
https://github.com/ruby/openssl/commit/6fa793d997
|
|
This list was originally in alphabetical order. Sort it again.
This change should be safe since the .rb sources should only depend on
the extension and not each other.
https://github.com/ruby/openssl/commit/eb3998728a
|
|
https://github.com/ruby/json/commit/1988a3ae4c
|
|
If `load_uint8x16_4` has an external linkage, it is defined in
both `generator` and `parser` extension libraries. This duplicate
symbol causes a linker error when `--with-static-linked-ext` is
given, on some platforms.
https://github.com/ruby/json/commit/020693b17a
|
|
https://github.com/ruby/json/commit/cfe9337eda
|