Commit graph

8776 commits

Author SHA1 Message Date
Jean Boussier
fd6225c7a9
[ruby/psych] Implement YAML.safe_dump to make safe_load more usable.
In case where Psych is used as a two way serializers,
e.g. to serialize some cache or config, it is preferable
to have the same restrictions on both load and dump.

Otherwise you might dump and persist some objects payloads
that you later won't be able to read.

441958396f
2021-06-07 19:15:14 +09:00
Yusuke Endoh
430883158f
[ruby/psych] Make YAML.load_file use YAML.load instead of safe_load
YAML.load and YAML.safe_load are different a little; the former allows
Symbol by default but the latter doesn't. So YAML.load_file and
YAML.safe_load_file should reflect the difference.

Fixes #490

f8a5e512a1
2021-06-07 19:15:14 +09:00
Daisuke Fujimura (fd0)
e451f0f678 Fix _MSC_VER warnings 2021-06-03 00:07:25 +09:00
Hiroshi SHIBATA
edcc29dcff Removed gdbm from ruby repo 2021-05-25 20:04:54 +09:00
Hiroshi SHIBATA
55cd3e4ebf Removed dbm from ruby repo 2021-05-25 15:18:31 +09:00
Nobuyoshi Nakada
1d170fdc6d
ext/json/parser/parser.h: Add fallback MAYBE_UNUSED
e2ad91fc20
2021-05-19 10:16:22 +09:00
Nobuyoshi Nakada
7c716b686c
ext/json/parser/prereq.mk: fix warnings for code generated by ragel
* type-limits when plain-char is unsigned
* unused-const-variable for NFA constants
2021-05-18 23:26:03 +09:00
Sutou Kouhei
79717f81f8 [ruby/fiddle] windows: link to ws2_32 for WSAGetLastError()
e9955d74ae
2021-05-18 12:48:40 +09:00
Sutou Kouhei
71d4a493b8 [ruby/fiddle] windows: add Fiddle.win32_last_socket_error{,=}
GitHub: fix GH-72

Users can't use WSAGetLastError() with Ruby 3.0 or later because
rb_funcall() resets the last socket error internally.

Users can get the last socket error by Fiddle.win32_last_socket_error.

Reported by Kentaro Hayashi. Thanks!!!

76158db00a
2021-05-18 12:48:40 +09:00
Sutou Kouhei
ab5212b3c9 [ruby/fiddle] Add support for "const" in type
GitHub: fix #68

Reported by kojix2. Thanks!!!

d7322c234a
2021-05-18 12:48:40 +09:00
Sutou Kouhei
4d1bb460f6 [ruby/fiddle] Add --enable-debug-build option to extconf.rb
e0498e60ea
2021-05-18 12:48:40 +09:00
Sutou Kouhei
791e8eec66 [ruby/fiddle] win32types: sort
35dec6c5a5
2021-05-18 12:48:40 +09:00
Sutou Kouhei
8758b07b1e [ruby/fiddle] Fix more Win32Types definitions
https://docs.microsoft.com/en-us/windows/win32/winprog/windows-data-types

805c1a595a
2021-05-18 12:48:40 +09:00
Orgad Shaneh
25e56fe374 [ruby/fiddle] Fix Win32Types for Windows 64-bit (#63)
https://docs.microsoft.com/en-us/windows/win32/winprog/windows-data-types

28ee5b1608
2021-05-18 12:48:40 +09:00
Sutou Kouhei
8d63b1dc75 [ruby/fiddle] Bump version
0cbd370fd6
2021-05-18 12:48:40 +09:00
Sutou Kouhei
881b2dc898 [ruby/fiddle] closure: add support for const char *
GitHub: fix GH-62

Reported by Cody Krieger. Thanks!!!

284b820f2d
2021-05-18 12:48:40 +09:00
Sutou Kouhei
b2de5999d8 [ruby/fiddle] closure: accept symbol as type
dc2da6633e
2021-05-18 12:48:40 +09:00
Sutou Kouhei
212d836cd7 [ruby/fiddle] Remove wrong comment
831522e768
2021-05-18 12:48:40 +09:00
Kenta Murata
7bd3d6d23e [ruby/fiddle] Bump version
63e5f98412
2021-05-18 12:48:40 +09:00
Hiroshi SHIBATA
ee611341c9
Bump version of required_ruby_version to 2.3. Fixes #464 2021-05-17 19:51:51 +09:00
Jean Boussier
2de594ca98
[flori/json] Deduplicate strings inside json_string_unescape
[ci 2]

1982070cb8
2021-05-17 19:51:51 +09:00
Jean Boussier
1d2b4ccaf2
[flori/json] Refactor json_string_unescape
f398769332
2021-05-17 19:51:50 +09:00
Masafumi Koba
8a974dc83c [flori/json] Fix incorrect # position in API doc
This change fixes an incorrect `#` position in the API documentation of the `JSON` module.

dc4b62424f
2021-05-17 19:26:03 +09:00
Aaron Patterson
42b20bdbfe
[ruby/psych] remove deprecated interface
0767227051
2021-05-17 11:20:46 +09:00
Aaron Patterson
b0e21197ce
[ruby/psych] Bump version
1df86a2e81
2021-05-17 11:20:46 +09:00
Aaron Patterson
fbb4e3f96c
[ruby/psych] Use Psych.safe_load by default
Psych.load is not safe for use with untrusted data.  Too many
applications make the mistake of using `Psych.load` with untrusted data
and that ends up with some kind of security vulnerability.

This commit changes the default `Psych.load` to use `safe_load`.  Users
that want to parse trusted data can use Psych.unsafe_load.

176494297f
2021-05-17 11:20:45 +09:00
Aaron Patterson
c7c2ad5749
[ruby/psych] Introduce Psych.unsafe_load
In future versions of Psych, the `load` method will be mostly the same
as the `safe_load` method.  In other words, the `load` method won't
allow arbitrary object deserialization (which can be used to escalate to
an RCE).  People that need to load *trusted* documents can use the
`unsafe_load` method.

This commit introduces the `unsafe_load` method so that people can
incrementally upgrade.  For example, if they try to upgrade to 4.0.0 and
something breaks, they can downgrade, audit callsites, change to
`safe_load` or `unsafe_load` as required, and then upgrade to 4.0.0
smoothly.

cb50aa8d3f
2021-05-17 11:20:45 +09:00
Jean Boussier
a3ceed50b8
[ruby/psych] Fix symabolize_name with non-string keys
1c5c29e81f
2021-05-17 11:20:45 +09:00
Jeremy Ebler
830778db95
[ruby/psych] feat: allow scalars and sequences to be styled when dumped
546154ddb7
2021-05-17 11:20:45 +09:00
Yusuke Endoh
f691c15792 ext/objspace/lib/objspace/trace.rb: Remove the original Kernel#p
... to disable a "method redefined" warning.

20210514T050008Z.fail.html.gz
```
  1) Failure:
TestObjSpace#test_objspace_trace [/export/home/chkbuild/chkbuild-gcc/tmp/build/20210514T050008Z/ruby/test/objspace/test_objspace.rb:621]:
<["objspace/trace is enabled"]> expected but was
<["/export/home/chkbuild/chkbuild-gcc/tmp/build/20210514T050008Z/ruby/.ext/common/objspace/trace.rb:29: warning: method redefined; discarding old p",
 "objspace/trace is enabled"]>.
```
2021-05-14 15:39:57 +09:00
Yusuke Endoh
cf1e1879f1 ext/objspace/lib/objspace/trace.rb: Added
This file, when require'ed, starts tracing the object allocations, and
redefines `Kernel#p` to show the allocation site.

This commit is experimental; the library name and APIs may change.

[Feature #17762]
2021-05-14 13:40:32 +09:00
Ryuta Kamizono
73136ebbde
[ruby/psych] Fix some typos [ci skip]
98617e55a1
2021-05-10 19:19:35 +09:00
Aaron Patterson
b7250026dd
[ruby/psych] bump version
091cd46b1f
2021-05-10 19:19:35 +09:00
Tim Gates
954970162c
[ruby/psych] docs: fix simple typo, expessed -> expressed
There is a small typo in ext/psych/yaml/yaml.h.

Should read `expressed` rather than `expessed`.

1150d669cb
2021-05-10 19:19:35 +09:00
Charles Oliver Nutter
1563de5997
[ruby/psych] Update to latest SnakeYAML
Fixes jruby/jruby#6365

a88ff77f02
2021-05-10 19:19:35 +09:00
Jean Boussier
c110ade0d2
[ruby/psych] Fix custom marshalization with symbolize_names: true
ee26f26ab5
2021-05-10 19:17:32 +09:00
Jean Boussier
155cd7fd2a
[ruby/psych] Cache dispatch cache in an instance variable
285c461cd2
2021-05-10 19:17:32 +09:00
Jean Boussier
3ab41acd36
[ruby/psych] Cache access to Psych.load_tags in Visitor::ToRuby
58223f0426
2021-05-10 19:17:32 +09:00
Matt Valentine-House
8bbd319806 Allow newobj_of0 and newobj_slowpath to allocate into multiple heap slots 2021-05-06 09:18:17 -04:00
Gannon McGibbon
a42b7de436 [ruby/strscan] Replace "iff" with "if and only if" (#18)
iff means if and only if, but readers without that knowledge might
assume this to be a spelling mistake. To me, this seems like
exclusionary language that is unnecessary. Simply using "if and only if"
instead should suffice.

066451c11e
2021-05-06 16:21:14 +09:00
Kenichi Kamiya
564ccd095a [ruby/strscan] Fix segmentation fault of StringScanner#charpos when String#byteslice returns non string value [Bug #17756] (#20)
92961cde2b
2021-05-06 16:20:38 +09:00
Hiroshi SHIBATA
822eb94563
Import from https://github.com/ruby/strscan/pull/19
* Use Gemfile instead of Gem::Specification#add_development_dependency.

* Use pend instead of skip for test-unit.
2021-05-06 16:18:58 +09:00
Benoit Daloze
0764d323d8 Fix -Wundef warnings for patterns #if HAVE
* See [Feature #17752]
* Using this to detect them:
  git grep -P 'if\s+HAVE' | grep -Pv 'HAVE_LONG_LONG|/ChangeLog|HAVE_TYPEOF'
2021-05-04 14:56:55 +02:00
Benoit Daloze
fa7a712d46 Fix -Wundef warnings for HAVE_RB_EXT_RACTOR_SAFE
* See [Feature #17752]
2021-05-04 14:56:55 +02:00
Benoit Daloze
59a92a84c8 Fix -Wundef warnings in core extensions
* See [Feature #17752]
2021-05-04 14:56:55 +02:00
Nobuyoshi Nakada
96fd1e1f22
Removed unused macro HAVE_CONFIG_H
It seems like a vestige of ext/md5.
2021-04-28 18:48:08 +09:00
Nobuyoshi Nakada
795fb51f80
NDEBUG is ignored since Ruby 3.0 2021-04-28 18:48:08 +09:00
Benoit Daloze
3a3b19b2bb Fix Monitor to lock per Fiber, like Mutex [Bug #17827] 2021-04-27 18:42:50 +02:00
Lars Kanis
22d36c463f [ruby/gdbm] Add dependency to gdbm package on mingw
RubyInstaller2 supports metadata tags for installation of dependent
MSYS2/MINGW libraries. The openssl gem requires the mingw-openssl
package to be installed on the system, which the gem installer takes
care about, when this tag is set.

The feature is documented here:
https://github.com/oneclick/rubyinstaller2/wiki/For-gem-developers#msys2-library-dependency

Fixes https://github.com/oneclick/rubyinstaller2/issues/163

d95eed3e86
2021-04-27 20:54:07 +09:00
Olle Jonsson
ad3f4c07d9 [ruby/pathname] gemspec: Explicitly list 0 executables
This gem exposes no executables.

c401d97d58
2021-04-27 20:52:48 +09:00