summaryrefslogtreecommitdiff
path: root/ext
AgeCommit message (Collapse)Author
2025-12-06[ruby/stringio] [DOC] Tweaks for StringIO#pos=Burdette Lamar
(https://github.com/ruby/stringio/pull/194) https://github.com/ruby/stringio/commit/3cef1e0e5f
2025-12-06[ruby/stringio] [DOC] Tweaks for StringIO#posBurdette Lamar
(https://github.com/ruby/stringio/pull/193) https://github.com/ruby/stringio/commit/90728bbbca
2025-12-06[ruby/stringio] [DOC] Tweaks for StringIO#lineno=Burdette Lamar
(https://github.com/ruby/stringio/pull/192) https://github.com/ruby/stringio/commit/8b1ee03cbe
2025-12-06[ruby/stringio] [DOC] Tweaks for StringIO#linenoBurdette Lamar
(https://github.com/ruby/stringio/pull/191) https://github.com/ruby/stringio/commit/f2a2a5a99e
2025-12-06[ruby/stringio] [DOC] Change link to on-pageBurdetteLamar
https://github.com/ruby/stringio/commit/a7c118d786
2025-12-06[ruby/openssl] asn1integer_to_num: don't cast away constTheo Buehler
ASN1_ENUMERATED_to_BN() has been const-correct for a long time in all supported libcrytos, so we can remove this workaround. https://github.com/ruby/openssl/commit/d0f36a7c65
2025-12-06[ruby/date] Call rb_gc_register_mark_object after object allocationPeter Zhu
It's possible that both half_days_in_day and day_in_nanoseconds are Ruby objects, which means that creating day_in_nanoseconds may trigger GC. Since half_days_in_day is not registered as a mark object until after day_in_nanoseconds is allocated, the GC may reclaim half_days_in_day. We can see this crash: ruby(rb_print_backtrace+0xb) [0x63a373c0] vm_dump.c:1105 ruby(rb_vm_bugreport) vm_dump.c:1450 ruby(rb_assert_failure_detail+0xdb) [0x6371d3a2] error.c:1216 ruby(RB_FL_TEST_RAW+0x0) [0x6371d3d5] error.c:1192 ruby(rb_assert_failure) (null):0 ruby(rb_gc_impl_writebarrier+0xb4) [0x636f01e4] gc/default/default.c:6103 ruby(pin_array_list_append+0x72) [0x638f9787] include/ruby/internal/gc.h:788 ruby(rb_vm_register_global_object) vm.c:4713 ruby(rb_gc_register_mark_object+0x3a) [0x6374144a] gc.c:3449 .ext/i686-linux-gnu/date_core.so(Init_date_core+0x204) [0xdbec86c4] ext/date/date_core.c:9511 .ext/i686-linux-gnu/date_core.so(Init_date_core) (null):0 ruby(dln_load_and_init+0x71) [0x6392c541] dln.c:521 ruby(dln_load_feature+0xd2) [0x6392c7d2] dln.c:566 ruby(load_ext+0xc3) [0x637931b3] load.c:1210 ruby(rb_vm_pop_frame+0x0) [0x638f80cd] vm.c:3120 ruby(rb_vm_call_cfunc_in_box) vm.c:3122 ruby(rb_long2num_inline+0x0) [0x637956f8] load.c:1353 ruby(require_internal) load.c:1354 ruby(rb_require_string_internal+0x60) [0x63795fa1] load.c:1457 ruby(rb_require_string) load.c:1443 https://github.com/ruby/date/commit/cbec5948e0
2025-12-06[ruby/openssl] Convert ossl_x509ext.c to opaque ASN1_STRINGTheo Buehler
https://github.com/ruby/openssl/commit/a41cf28bab
2025-12-06[ruby/openssl] Convert ossl_ts.c to opaque ASN1_STRINGTheo Buehler
https://github.com/ruby/openssl/commit/8945f379b3
2025-12-06[ruby/openssl] Convert ossl_ns_spki.c to opaque ASN1_STRINGTheo Buehler
https://github.com/ruby/openssl/commit/0941ebbda5
2025-12-06[ruby/openssl] Convert some of ossl_asn1.c to opaque ASN1_STRINGTheo Buehler
This uses the normal accessors but leaves out BIT STRINGS, which will need compat implementations for ASN1_BIT_STRING_get_length() and ASN1_BIT_STRING_set1() for older libcryptos. https://github.com/openssl/openssl/issues/29184 https://github.com/openssl/openssl/issues/29185 https://github.com/ruby/openssl/commit/ba3d1cc5c2
2025-12-06[ruby/openssl] Convert ossl_ocsp.c to opaque ASN1_STRINGTheo Buehler
OpenSSL plans to make asn1_string_st opaque, the struct underlying most ASN.1 types such as ASN1_*STRING, ASN1_ENUMERATED, ASN1_INTEGER, etc. Most of ruby/openssl's C code can be straigtforwardly converted to use accessors available since OpenSS https://github.com/ruby/openssl/commit/374262435a
2025-12-06[ruby/openssl] const correct ossl_bin2hex()Theo Buehler
This helper only reads from its in parameter. Making that const avoids a couple of casts in an upcoming change. https://github.com/ruby/openssl/commit/970d5764e3
2025-12-06Yield to scheduler if interrupts are pending. (#14700)Samuel Williams
2025-12-06[ruby/stringio] [DOC] Link to on-page section, not class File docBurdetteLamar
https://github.com/ruby/stringio/commit/dc93aa51d2
2025-12-05[ruby/openssl] x509cert: handle invalid validity periods in Certificate#inspectKazuki Yamaguchi
In a newly allocated OpenSSL X509 object, the notBefore and notAfter fields contain an ASN1_STRING object with type V_ASN1_UNDEF rather than an ASN1_TIME. Commit https://github.com/ruby/openssl/commit/73484f67949a made asn1time_to_time() stricter and it now raises an exception if the argument is not an ASN1_TIME. Previously, it would print a verbose-mode warning and return nil. OpenSSL::X509::Certificate#inspect should work even when the certificate is invalid. Let's handle this. https://github.com/ruby/openssl/commit/18c283f2b6
2025-12-05[ruby/psych] Use Node#to_ruby parse_symbols optionÉtienne Barrié
https://github.com/ruby/psych/commit/907fd4fa97
2025-12-05Use VWA for bignumJohn Hawthorn
Previously we only allocated bignums from the 40 byte sizepool, and embedded bignum used a fixed size.
2025-12-05[ruby/openssl] asn1: use ASN1_TIME_to_tm() to decode UTCTime and GeneralizedTimeKazuki Yamaguchi
The current logic relies on sscanf() and error checks are almost entirely missing. It also assumes that ASN1_STRING contents are NUL terminated, which is undocumented and not guaranteed for all valid ASN1_TIME objects. Switch to using ASN1_TIME_to_tm() added in OpenSSL 1.1.1. It is also supported by LibreSSL and AWS-LC. In the long term, we may want to replace ASN1_TIME_to_tm() with a hand-rolled decoder, since the function is intended for a specific use-case. It is too permissive for strict DER, yet still does not support all valid DER inputs and silently drops information such as fractional seconds. However, it handles everything that the current sscanf() code could handle. https://github.com/ruby/openssl/commit/73484f6794
2025-12-05[ruby/openssl] asn1: reorder declarationsKazuki Yamaguchi
Move variable declarations for OpenSSL::ASN1 classes to the top of the file. asn1time_to_time() will need eASN1Error in the next patch. https://github.com/ruby/openssl/commit/6c0ef87897
2025-12-04[ruby/openssl] Expand tabs in C source filesKazuki Yamaguchi
Since around 2018, we have been using spaces for indentation for newly added code[1]. The mixed use of tabs and spaces has repeatedly confused new contributors who configured their editors to use a different tab size than 8. Since git blame can now skip specific commits, ruby/ruby did a mass reformatting of tabs in 2022[2]. Do the same in ruby/openssl. While at it, fix a few indentation issues, mainly in switch-case labels and in ossl_ssl_session.c, which used doubled indentation size. This patch contains white-space changes only. git diff -w output should be empty. [1] https://bugs.ruby-lang.org/issues/14246 [2] https://bugs.ruby-lang.org/issues/18891 https://github.com/ruby/openssl/commit/4d6214f507
2025-12-04[ruby/openssl] Revert "rewriting most of the asn1 init code in ruby"Kazuki Yamaguchi
This reverts commit https://github.com/ruby/openssl/commit/830505172882. The commit is part of the bigger effort to rewrite OpenSSL::ASN1 in Ruby. OpenSSL::ASN1 is relatively isolated from the rest of ruby/openssl and is not tightly bound to the OpenSSL API. The current implementation also needs a major refactor for several reasons, so this remains a long-term goal. However, the work is not yet complete. We are close to releasing v4.0.0, and we want to avoid shipping fragmented code in a stable branch. The changes can be reapplied when the rest is ready. https://github.com/ruby/openssl/commit/362942dcbf
2025-12-04[ruby/json] Release 2.17.1Jean Boussier
https://github.com/ruby/json/commit/e5e4fd558e
2025-12-04[ruby/json] Fix a regression in parsing of unicode surogate pairsJean Boussier
Fix: https://github.com/ruby/json/issues/912 In the case of surogate pairs we consume two backslashes, so `json_next_backslash` need to ensure it's not sending us back in the stream. https://github.com/ruby/json/commit/0fce370c41
2025-12-04[ruby/psych] Add option to disable symbol parsingCaleb Stewart
https://github.com/ruby/psych/commit/4e9d08c285
2025-12-04[ruby/psych] Remove y Object extension in IRBRune Philosof
Fixes: ruby#685 This feature can easily break how you use other gems like factory_bot or prawn. https://github.com/ruby/psych/pull/747#issuecomment-3413139525 > But I kind of think we should leave `psych/y` around. If people really want to use it they could require the file. If you miss the function in Kernel, you can require it interactively or add it to `.irbrc`: ```ruby require 'psych/y' ``` https://github.com/ruby/psych/commit/f1610b3f05
2025-12-03[ruby/json] Release 2.17.0Jean Boussier
https://github.com/ruby/json/commit/4bdb2d14fe
2025-12-03[ruby/json] Fix handling of depthÉtienne Barrié
https://github.com/ruby/json/commit/ccca602274
2025-12-03fstring_concurrent_set_create: only assert the string has no ivarsJean Boussier
The NEWOBJ tracepoint can generate an object_id, that's alright, what we don't want is actual instance variables.
2025-12-03Rename `rb_obj_exivar_p` -> `rb_obj_gen_fields_p`Jean Boussier
The "EXIVAR" terminology has been replaced by "gen fields" AKA "generic fields". Exivar implies variable, but generic fields include more than just variables, e.g. `object_id`.
2025-12-03[ruby/json] Test and restore behavior around to_json changing depthÉtienne Barrié
When serializing an Array, and one of the elements of the Array requires calling `to_json`, if the depth is changed, it will be used for the next entries, which wasn't the case before https://github.com/ruby/json/commit/5abd43490714, and is not the case with TruffleRuby and JRuby. Additionally, with TruffleRuby and JRuby the state's depth after the `to_json` call is used to close the Array, which isn't the case with CRuby. https://github.com/ruby/json/commit/386b36fde5
2025-12-03[ruby/json] Improve `JSON.load` and `JSON.unsafe_load` to allow passing ↵Jean Boussier
options as second argument Otherwise it's very error prone. https://github.com/ruby/json/commit/c54de70f90
2025-12-03Handle NEWOBJ tracepoints settings fieldsJean Boussier
[Bug #21710] - struct.c: `struct_alloc` It is possible for a `NEWOBJ` tracepoint call back to write fields into a newly allocated object before `struct_alloc` had the time to set the `RSTRUCT_GEN_FIELDS` flags and such. Hence we can't blindly initialize the `fields_obj` reference to `0` we first need to check no fields were added yet. - object.c: `rb_class_allocate_instance` Similarly, if a `NEWOBJ` tracepoint tries to set fields on the object, the `shape_id` must already be set, as it's required on T_OBJECT to know where to write fields. `NEWOBJ_OF` had to be refactored to accept a `shape_id`.
2025-12-03[ruby/json] Fix macro argumentsNobuyoshi Nakada
`ALWAYS_INLINE()` and `NOINLINE()` are defined with one argument. https://github.com/ruby/json/commit/8fb727901e
2025-12-02[ruby/psych] Properly set the message of Exceptions on TruffleRubyBenoit Daloze
* From https://github.com/truffleruby/truffleruby/commit/1f81db82d2969ff7c5de0dacdecb38252664f42c https://github.com/ruby/psych/commit/dbabe7aac6
2025-12-02[ruby/psych] Fix usage of rb_struct_initialize() to pass an Array of members ↵Benoit Daloze
values and not a Hash * rb_struct_initialize() does not accept a Hash, and it's very brittle to pass `[{...}]` and to rely on that C function using rb_keyword_given_p(). It basically worked accidentally, by having **members in the caller of the caller. Such logic when Struct#initialize is defined in Ruby (as in TruffleRuby) is basically impossible to implement, because it's incorrectly treating positional arguments as keyword arguments. * rb_struct_initialize() is used in CRuby to set members of Data instances in marshal.c (there is no rb_data_initialize() yet). There, the code passes an Array of members values for Data (and for Struct which are not `keyword_init: true`): https://github.com/ruby/ruby/blob/48c7f349f68846e10d60ae77ad299a38ee014479/marshal.c#L2150-L2176 So we should do the same in psych. * Rename to init_data since it's only used for Data. * See https://github.com/ruby/psych/pull/692#discussion_r2483947279. https://github.com/ruby/psych/commit/3550148378
2025-11-29[ruby/openssl] Remove dummy declarations for mOSSL and eOSSLErrorKazuki Yamaguchi
These declarations were added to every source file because older versions of RDoc did not resolve ancestor tree across files. Since RDoc 6.9.0 supports this, this workaround is no longer needed. https://redirect.github.com/ruby/rdoc/pull/1217 https://github.com/ruby/openssl/commit/6491ce63be
2025-11-29[ruby/openssl] ts: fix docs for attrs on OpenSSL::Timestamp::FactoryKazuki Yamaguchi
Move attribute documentation out of the class-level section and into the appropriate sections so that they attach correctly. https://github.com/ruby/openssl/commit/61410acc50
2025-11-27Reorganize page documentations (#15154)Stan Lo
Re-organize page docs
2025-11-27[ruby/json] Respect Coder depth when generatingÉtienne Barrié
https://github.com/ruby/json/commit/9c36681b17
2025-11-27[DOC] Include strscan/libNAITOH Jun
2025-11-26[ruby/json] Don't copy JSON_Generator_State in generate_newÉtienne Barrié
Now that the state isn't mutated in generate_new, we no longer need to copy the struct, we can just use it. https://github.com/ruby/json/commit/d7964f8892
2025-11-26[ruby/json] Don't write depth to JSON_Generator_State in some casesÉtienne Barrié
For `JSON.generate` and `JSON::State#generate_new`, don't copy generate_json_data::depth to JSON_Generator_State::depth. In `JSON.generate`, the JSON_Generator_State is on the stack and discarded anyway. In `JSON::State#generate_new`, we copy the struct to avoid mutating the original one. https://github.com/ruby/json/commit/873b29ea34
2025-11-26[ruby/json] Add depth to struct generate_json_dataÉtienne Barrié
Instead of incrementing JSON_Generator_State::depth, we now increment generate_json_data::depth, and only copied at the end. https://github.com/ruby/json/commit/5abd434907
2025-11-26[ruby/cgi] Fix mixed declarations and codeNobuyoshi Nakada
Use C90 syntax only, as far as supporting ruby 2.6 or earlier. https://github.com/ruby/cgi/commit/886c82982a
2025-11-23[Bug #21705] Fix segfaults on WindowsNobuyoshi Nakada
It should check the type of the argument and coercion before converting the encoding.
2025-11-22[ruby/openssl] asn1: refactor converting ASN1_OBJECT to stringKazuki Yamaguchi
ruby/openssl exposes OIDs to Ruby as strings in many places, but the conversion logic has been duplicated and the behavior is inconsistent. There are mainly two patterns: - Returns the short name associated with the OID/NID, or the dotted decimal notation if it is unknown to OpenSSL. - Returns the long name, or the dotted decimal notation. These patterns are implemented using different OpenSSL APIs and that caused subtle differences. Add helper functions ossl_asn1obj_to_string() and ossl_asn1obj_to_string_long_name() to unify the logic. Also, document the current behaviors where it is not yet done. The inconsistency was likely unintentional, but since it dates back to the original implementations, standardizing it now would cause more issues than it resolves. https://github.com/ruby/openssl/commit/2ea36c21a4
2025-11-22[ruby/openssl] ts: refactor converting string to ASN1_OBJECTKazuki Yamaguchi
obj_to_asn1obj() in ossl_ts.c and ossl_asn1.c are identical. Let's remove one in ossl_ts.c. eASN1Error can now be made static to ossl_asn1.c. https://github.com/ruby/openssl/commit/dcb05c40c2
2025-11-22[ruby/openssl] pkey/ec: fix OpenSSL::PKey::EC::Group#curve_name for unknown ↵Kazuki Yamaguchi
curves EC_GROUP_get_curve_name() returns NID_undef when OpenSSL does not recognize the curve and there is no associated OID. Handle this case explicitly and return nil instead of the string "UNDEF", which should not be exposed outside the extension. https://github.com/ruby/openssl/commit/2c16821c07
2025-11-22[ruby/json] parser.c: Record escape positions while parsingJean Boussier
We can then pass them to the decoder to save having to parse the string again. ``` == Parsing activitypub.json (58160 bytes) ruby 3.4.6 (2025-09-16 revision https://github.com/ruby/json/commit/dbd83256b1) +YJIT +PRISM [arm64-darwin24] Warming up -------------------------------------- after 1.275k i/100ms Calculating ------------------------------------- after 12.774k (± 0.8%) i/s (78.29 μs/i) - 65.025k in 5.090834s Comparison: before: 12314.3 i/s after: 12773.8 i/s - 1.04x faster == Parsing twitter.json (567916 bytes) ruby 3.4.6 (2025-09-16 revision https://github.com/ruby/json/commit/dbd83256b1) +YJIT +PRISM [arm64-darwin24] Warming up -------------------------------------- after 143.000 i/100ms Calculating ------------------------------------- after 1.441k (± 0.2%) i/s (693.86 μs/i) - 7.293k in 5.060345s Comparison: before: 1430.1 i/s after: 1441.2 i/s - 1.01x faster == Parsing citm_catalog.json (1727030 bytes) ruby 3.4.6 (2025-09-16 revision https://github.com/ruby/json/commit/dbd83256b1) +YJIT +PRISM [arm64-darwin24] Warming up -------------------------------------- after 69.000 i/100ms Calculating ------------------------------------- after 695.919 (± 0.4%) i/s (1.44 ms/i) - 3.519k in 5.056691s Comparison: before: 687.8 i/s after: 695.9 i/s - 1.01x faster ``` https://github.com/ruby/json/commit/4f4551f993