summaryrefslogtreecommitdiff
path: root/ext
AgeCommit message (Collapse)Author
2019-08-26merge revision(s) ↵usa
3f9562015e651735bfc2fdd14e8f6963b673e22a,c06ddfee878524168e4af07443217ed2f8d0954b,3b3b4a44e5: [Backport #15792] Get rid of indirect sharing * string.c (str_duplicate): share the root shared string if the original string is already sharing, so that all shared strings refer the root shared string directly. indirect sharing can cause a dangling pointer. [Bug #15792] str_duplicate: Don't share with a frozen shared string This is a follow up for 3f9562015e651735bfc2fdd14e8f6963b673e22a. Before this commit, it was possible to create a shared string which shares with another shared string by passing a frozen shared string to `str_duplicate`. Such string looks like: ``` -------- ----------------- | root | ------ owns -----> | root's buffer | -------- ----------------- ^ ^ ^ ----------- | | | shared1 | ------ references ----- | ----------- | ^ | ----------- | | shared2 | ------ references --------- ----------- ``` This is bad news because `rb_fstring(shared2)` can make `shared1` independent, which severs the reference from `shared1` to `root`: ```c /* from fstr_update_callback() */ str = str_new_frozen(rb_cString, shared2); /* can return shared1 */ if (STR_SHARED_P(str)) { /* shared1 is also a shared string */ str_make_independent(str); /* no frozen check */ } ``` If `shared1` was the only reference to `root`, then `root` can be reclaimed by the GC, leaving `shared2` in a corrupted state: ``` ----------- -------------------- | shared1 | -------- owns --------> | shared1's buffer | ----------- -------------------- ^ | ----------- ------------------------- | shared2 | ------ references ----> | root's buffer (freed) | ----------- ------------------------- ``` Here is a reproduction script for the situation this commit fixes. ```ruby a = ('a' * 24).strip.freeze.strip -a p a 4.times { GC.start } p a ``` - string.c (str_duplicate): always share with the root string when the original is a shared string. - test_rb_str_dup.rb: specifically test `rb_str_dup` to make sure it does not try to share with a shared string. [Bug #15792] Closes: https://github.com/ruby/ruby/pull/2159 Update dependencies git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_5@67766 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-03-13merge revision(s) 67200: [Backport #15648]nagachika
Add ignored_sp event * ext/ripper/lib/ripper/lexer.rb (Ripper::Lexer): add ignored_sp event which will be fired from Ripper::Lexer#on_heredoc_dedent method. [ruby-core:91727] [Bug #15648] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_5@67242 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-03-12merge revision(s) 64636,64637: [Backport #15659]nagachika
AIX doesn't set OptionLength for boolean options https://rubyci.org/logs/rubyci.s3.amazonaws.com/aix71_ppc/ruby-trunk/log/20180904T103302Z.fail.html.gz https://www.ibm.com/support/knowledgecenter/ja/ssw_aix_72/com.ibm.aix.commtrf2/getsockopt.htm fix typo git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_5@67228 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-03-11merge revision(s) 67203: [Backport #15651]nagachika
numeric.c: fix infinite loop * numeric.c (int_pow): fix infinite loop in the case of y equal 1 and power of x does not overflow. [ruby-core:91734] [Bug #15651] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_5@67219 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-03-06merge revision(s) 67183: [Backport #15607]nagachika
Fix PTY.open on OpenBSD [Bug #15607] From: Jeremy Evans <code@jeremyevans.net> git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_5@67186 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-10-17Import Ruby/OpenSSL 2.1.2.nagachika
Original patches are written by rhe. Changes since v2.1.1 can be found at the upstream GitHub repository: https://github.com/ruby/openssl/compare/v2.1.1..v2.1.2 Kazuki Yamaguchi (9): pkey: resume key generation after interrupt tool/ruby-openssl-docker: update to latest versions test/test_ssl: fix test failure with TLS 1.3 test/test_x509name: change script encoding to ASCII-8BIT x509name: refactor OpenSSL::X509::Name#to_s x509name: fix handling of X509_NAME_{oneline,print_ex}() return value x509name: fix OpenSSL::X509::Name#{cmp,<=>} Ruby/OpenSSL 2.0.9 Ruby/OpenSSL 2.1.2 nobu (6): no ID cache in Init functions search winsock libraries explicitly openssl: search winsock openssl_missing.h: constified reduce LibreSSL warnings needs openssl/opensslv.h git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_5@65132 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-08-18merge revision(s) 63406: [Backport #14754]nagachika
openssl: merge changes in v2.1.1 Commits in upstream repository since v2.1.0 can be found at: https://github.com/ruby/openssl/compare/v2.1.0...v2.1.1 ---------------------------------------------------------------- Kazuki Yamaguchi (7): test/utils: disable Thread's report_on_exception in start_server cipher: validate iterations argument for Cipher#pkcs5_keyivgen extconf.rb: fix build with LibreSSL 2.7.0 test/test_pkey_rsa: fix test failure with OpenSSL 1.1.1 test/test_ssl_session: set client protocol version explicitly Ruby/OpenSSL 2.0.8 Ruby/OpenSSL 2.1.1 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_5@64428 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-07-02merge revision(s) 63304: [Backport #14713]nagachika
io.c: workaround for EPROTOTYPE * io.c (internal_write_func, internal_writev_func): retry at unexpected EPROTOTYPE on macOS, to get rid of a kernel bug. [ruby-core:86690] [Bug #14713] * ext/socket/init.c (rsock_{sendto,send,write}_blocking): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_5@63826 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-28Revert wrong commit r62976-r62978naruse
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_5@63010 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-28merge revision(s) 63000:naruse
unixsocket.c: abstract namespace * ext/socket/unixsocket.c (unixsock_path_value): fix r62991 for Linux abstract namespace. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_5@63009 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-28sdbm: constifiednaruse
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_5@62978 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-28sdbm: check offsetnaruse
* ext/sdbm/_sdbm.c (splpage): check offset range. https://hackerone.com/reports/271291 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_5@62977 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-28sdbm: check offsetnaruse
* ext/sdbm/_sdbm.c (getpair, getnkey): check offset range. https://hackerone.com/reports/271096 * ext/sdbm/init.c (fsdbm_each_pair): raise if fetch failed. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_5@62976 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-28unixsocket.c: check NUL bytesnaruse
* ext/socket/unixsocket.c (rsock_init_unixsock): check NUL bytes. https://hackerone.com/reports/302997 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_5@62973 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-02-28merge revision(s) 62572: [Backport #14549]naruse
date_core.c: defensive code * ext/date/date_core.c (f_cmp): check comparison failure. * ext/date/date_core.c (d_lite_step): deal with the comparison result more defensively. [ruby-core:85796] [Bug #14549] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_5@62610 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-02-20merge revision(s) 62116,62151: [Backport #14425]naruse
ruby.h: relax rb_funcall check on extra args for clang clang 5.+ (tested clang 7.0.0) seems to be attempting division-by-zero and giving a very large number for static args to rb_funcall. * include/ruby/ruby.h (rb_varargs_bad_length): relax check for clang * ext/-test-/funcall/funcall.c: renamed from passing_block.c define extra_args_name function * test/-ext-/funcall/test_funcall.rb: new test [ruby-core:85266] [Bug #14425] From: Eric Wong <e@80x24.org> ruby.h: relax rb_funcall(obj, id, 0, 0) case only * include/ruby/ruby.h (rb_varargs_argc_valid_p): relax rb_funcall check on extra args only if argc == 0, for the compatibility with wrong code which is probably confused with rb_funcallv. [Bug #14425] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_5@62501 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-24bigdecimal: version 1.3.4mrkn
Import bigdecimal version 1.3.4. The full commit log is here: https://github.com/ruby/bigdecimal/compare/v1.3.3...v1.3.4 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61441 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-22[DOC] StringIO#write accepts multiple arguments since r60377 [ci skip]kazu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61407 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-22ifaddr.c: get_ifaddrsnobu
* ext/socket/ifaddr.c (get_ifaddrs): extract ifaddrs from Socket::Ifaddr. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61404 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-21Fix `imemo_name` to dump new imemo typestenderlove
New IMEMO types were introduced, this just fixes the function that converts the type to support the new types. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61377 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-19Merge psych-3.0.2 from ruby/psych.hsbt
It version changed fallback option to keywoad argument on `Yaml.load` method. It break backword compatiblity. see detailed discuttion: https://github.com/ruby/psych/issues/340 From: SHIBATA Hiroshi <hsbt@ruby-lang.org> git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61336 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-19Update version of strscan to 1.0.0.hsbt
But we couldn't ship strscan (and stringio) gem. Because rubygems.org still masked them. https://github.com/rubygems/rubygems.org/pull/1696 I'm going to ship them after it deployed. From: SHIBATA Hiroshi <hsbt@ruby-lang.org> git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61333 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-19Remove digest.gemspec for default gems.hsbt
It needs to support header file installation and uninstallation. But current RubyGems didn't support it feature yet. From: SHIBATA Hiroshi <hsbt@ruby-lang.org> git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61332 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-15gperf.sed: static declarationsnobu
* tool/gperf.sed: comment out arguments part only, to keep the following declarations static. [Feature #13883] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61282 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-14openssl: import v2.1.0rhe
Import Ruby/OpenSSL 2.1.0. Commits since v2.1.0.beta2 can be found at: https://github.com/ruby/openssl/compare/v2.1.0.beta2...v2.1.0 ---------------------------------------------------------------- Kazuki Yamaguchi (8): test/test_ssl: prevent changing default internal encoding ssl: remove a misleading comment pkey/ec: rearrange PKey::EC::Point#initialize ssl: remove unreachable code asn1: fix docs pkey/ec: add support for octet string encoding of EC point Ruby/OpenSSL 2.0.7 Ruby/OpenSSL 2.1.0 eregon (1): Fix test-all tests to avoid creating report_on_exception warnings git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61235 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-14NaCl support is dropped at r60374naruse
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61234 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-14bigdecimal: dependencynobu
* ext/bigdecimal/extconf.rb: extconf.h depends on the gemspec file. [ruby-core:84247] [Bug #14180] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61221 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-13bigdecimal: version 1.3.3mrkn
Import bigdecimal version 1.3.3. The full commit log is here: https://github.com/ruby/bigdecimal/compare/v1.3.2...v1.3.3 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61213 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-13Ripper::Lexer bit predicatesnobu
* ext/ripper/lib/ripper/lexer.rb (Ripper::Lexer): added allbits?, anybits? and nobits? methods, as well as Integer. a patch by aycabta. [Feature #14170] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61205 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-13Bump version to etc-1.0.0 as default gems.hsbt
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61201 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-12ext/coverage/coverage.c: remove COVERAGE_EXPERIMENTAL_MODEmame
A NEWS entry is also added. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61129 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-11Bump version to zlib-1.0.0 as default gems.hsbt
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61115 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-11Bump version to sdbm-1.0.0 as default gems.hsbt
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61113 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-11Bump version to fcntl-1.0.0 as default gems.hsbt
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61112 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-11Bump version to date-1.0.0 as default gems.hsbt
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61110 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-08ext/strscan/strscan.c: [DOC] grammar fixesstomar
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61085 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-08support gperf 3.1nobu
* tool/gperf.sed: extracted sed commands to a script. ANSI-C code produced by gperf 3.1 declares length arguments as `size_t`. it causes conflict with existing declarations, and needs casts for a local variable and return statements. [Feature #13883] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61076 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-06Bump fiddle-1.0.0 for released version.hsbt
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61053 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-06Bump gdbm-2.0.0 for released versionn.hsbt
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61052 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-06Bump dbm-1.0.0 for released version.hsbt
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61051 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-05ext/coverage/coverage.c: method coverage has column info. of method def.mame
This change makes method coverage result have not only first lineno of method defintion, but also code range (i.e. first lineno, first column, last lineno, and last column). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61026 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-05vm_core.h (rb_iseq_locatoin_t): add a field `code_range`mame
This change makes each ISeq keep NODE's code range. This information is needed for method coverage. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61025 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-05Revamp method coverage to support define_methodmame
Traditionally, method coverage measurement was implemented by inserting `trace2` instruction to the head of method iseq. So, it just measured methods defined by `def` keyword. This commit drastically changes the measuring mechanism of method coverage; at `RUBY_EVENT_CALL`, it keeps a hash from rb_method_entry_t* to runs (i.e., it counts the runs per method entry), and at `Coverage.result`, it creates the result hash by enumerating all `rb_method_entry_t*` objects (by `ObjectSpace.each_object`). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61023 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-04hide internal data objectsnobu
* marshal.c (compat_allocator_table): hide the wrapper object of compat_allocator_tbl. * process.c (rb_execarg_new): hide wrapper objects of struct rb_execarg. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61009 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-04ifaddr.c: fix memsizenobu
* ext/socket/ifaddr.c (ifaddr_memsize): do not count the whole rb_ifaddr_t array for each elements. the header size is included in the first element for the time being. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61006 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-03ifaddr.c: unused membernobu
* ext/socket/ifaddr.c (struct rb_ifaddr_tag): removed set but unused member root. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61001 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-03Init functions should have prefix to avoid confliction.shugo
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60990 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-02staticnaruse
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60982 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-02Update dependenciesnaruse
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60981 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-02string.c: fix rb_external_str_new_with_encnobu
* string.c (rb_external_str_new_with_enc): do not search non-ascii by NULL pointer. [ruby-core:84055] [Bug #14150] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60979 b2dd03c8-39d4-4d8f-98ff-823fe69b080e