psych 5.5.0-java → 5.5.1-java

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7429988183a896844c649cc6c90e91f722a0a5bb97d48266e76f3ec81706a750
4
- data.tar.gz: 27660902dac288a8ff13063046809f41c22dc4371e0fe4d496b34ad63f7ffa37
3
+ metadata.gz: 74ed1114e0b28695a5895c24a53b117485d5d379f8798742c0e201a3a11c481e
4
+ data.tar.gz: 779ab19a63e585c75d58b9b6d426e6466f3812a780b549714a80b1b10952fe50
5
5
  SHA512:
6
- metadata.gz: 675ef39857c198e61ca4e3aa2b8b3db97971e09ce3330a3d5fab1d4658d0c73eef19e001616064fbd8783414dd8807ddec60a0aebc557c770b93bf54f6eff3aa
7
- data.tar.gz: bd40e9dd4011b980631e11615f60ade26630ef7e9b1a4ef64fe982e52f0d90dc610a83c0610a02c734741ec3d0d13b18978e92bb45f7f7693da0a5c389327cef
6
+ metadata.gz: f5009e5bb754489b0a6783e8c769875f6f15a8d05414185929d776c875f09bebdcd0143f83378ee2f5ce1d384a5c04f93b610d2be726a01136274ecf3edac3b9
7
+ data.tar.gz: dc22703c2c2a7c6ad0d362133abd1894266e44742f20ae92907df2dabbc343fded431358d405dc3624ff77669563c03a8ce0fb0a0e1f9bae76ff3e09629a8e09
data/ext/psych/depend CHANGED
@@ -12,6 +12,17 @@ distclean-so::
12
12
  -cd libyaml && $(MAKE) distclean
13
13
  -$(Q)$(RMDIRS) libyaml/* libyaml
14
14
 
15
- $(OBJS): $(HDRS) $(ruby_headers) \
16
- $(hdrdir)/ruby/encoding.h \
17
- $(hdrdir)/ruby/oniguruma.h
15
+ # AUTOGENERATED DEPENDENCIES START
16
+ psych.o psych_emitter.o psych_emitter_fy.o psych_parser.o psych_parser_fy.o psych_to_ruby.o psych_yaml_tree.o: psych.h
17
+ psych.o psych_emitter.o psych_emitter_fy.o psych_parser.o psych_parser_fy.o psych_to_ruby.o psych_yaml_tree.o: psych_emitter.h
18
+ psych.o psych_emitter.o psych_emitter_fy.o psych_parser.o psych_parser_fy.o psych_to_ruby.o psych_yaml_tree.o: psych_parser.h
19
+ psych.o psych_emitter.o psych_emitter_fy.o psych_parser.o psych_parser_fy.o psych_to_ruby.o psych_yaml_tree.o: psych_to_ruby.h
20
+ psych.o psych_emitter.o psych_emitter_fy.o psych_parser.o psych_parser_fy.o psych_to_ruby.o psych_yaml_tree.o: psych_yaml_tree.h
21
+ psych.o: psych.c
22
+ psych_emitter.o: psych_emitter.c
23
+ psych_emitter_fy.o: psych_emitter_fy.c
24
+ psych_parser.o: psych_parser.c
25
+ psych_parser_fy.o: psych_parser_fy.c
26
+ psych_to_ruby.o: psych_to_ruby.c
27
+ psych_yaml_tree.o: psych_yaml_tree.c
28
+ # AUTOGENERATED DEPENDENCIES END
data/ext/psych/psych.h CHANGED
@@ -4,6 +4,10 @@
4
4
  #include <ruby.h>
5
5
  #include <ruby/encoding.h>
6
6
 
7
+ #ifndef HAVE_RB_LEN_T
8
+ typedef long rb_len_t;
9
+ #endif
10
+
7
11
  #ifdef PSYCH_USE_LIBFYAML
8
12
  #include <libfyaml.h>
9
13
  #else
@@ -25,7 +25,7 @@ static void emit(yaml_emitter_t * emitter, yaml_event_t * event)
25
25
  static int writer(void *ctx, unsigned char *buffer, size_t size)
26
26
  {
27
27
  VALUE self = (VALUE)ctx, io = rb_attr_get(self, id_io);
28
- VALUE str = rb_enc_str_new((const char *)buffer, (long)size, rb_utf8_encoding());
28
+ VALUE str = rb_enc_str_new((const char *)buffer, (rb_len_t)size, rb_utf8_encoding());
29
29
  VALUE wrote = rb_funcall(io, id_write, 1, str);
30
30
  return (int)NUM2INT(wrote);
31
31
  }
@@ -172,8 +172,8 @@ static VALUE start_document_try(VALUE d)
172
172
  }
173
173
 
174
174
  if(RTEST(tags)) {
175
- long i = 0;
176
- long len;
175
+ rb_len_t i = 0;
176
+ rb_len_t len;
177
177
  rb_encoding * encoding = rb_utf8_encoding();
178
178
 
179
179
  Check_Type(tags, T_ARRAY);
@@ -419,7 +419,7 @@ static VALUE parse_body(VALUE ptr)
419
419
  VALUE plain_implicit, quoted_implicit, style;
420
420
  VALUE val = rb_str_new(
421
421
  (const char *)event.data.scalar.value,
422
- (long)event.data.scalar.length
422
+ (rb_len_t)event.data.scalar.length
423
423
  );
424
424
 
425
425
  PSYCH_TRANSCODE(val, encoding, internal_enc);
@@ -35,6 +35,11 @@ module Psych
35
35
  sym.to_sym
36
36
  end
37
37
 
38
+ # Raises if instance variables may not be restored on +obj+. The
39
+ # unrestricted loader allows instance variables on any object.
40
+ def check_ivars obj
41
+ end
42
+
38
43
  constants.each do |const|
39
44
  konst = const_get const
40
45
  class_eval <<~RUBY, __FILE__, __LINE__ + 1
@@ -76,6 +81,12 @@ module Psych
76
81
  }.compact].freeze
77
82
 
78
83
  class Restricted < ClassLoader
84
+ # Core classes whose instances must not have instance variables
85
+ # restored on them unless the class is explicitly permitted. Exact
86
+ # class match only, so permitted subclasses (for example a String
87
+ # subclass with its own ivars) still load.
88
+ BUILTIN_CLASSES = [::String, ::Hash].freeze
89
+
79
90
  def initialize classes, symbols
80
91
  @classes = classes
81
92
  @symbols = symbols
@@ -92,6 +103,13 @@ module Psych
92
103
  end
93
104
  end
94
105
 
106
+ def check_ivars obj
107
+ klass = obj.class
108
+ if BUILTIN_CLASSES.include?(klass) && !@classes.include?(klass.name)
109
+ raise DisallowedInstanceVariables.new(klass.name)
110
+ end
111
+ end
112
+
95
113
  private
96
114
 
97
115
  def find klassname
@@ -25,4 +25,10 @@ module Psych
25
25
  super "Tried to #{action} unspecified class: #{klass_name}"
26
26
  end
27
27
  end
28
+
29
+ class DisallowedInstanceVariables < Exception
30
+ def initialize klass_name
31
+ super "Tried to set instance variables on unspecified class: #{klass_name}"
32
+ end
33
+ end
28
34
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Psych
4
4
  # The version of Psych you are using
5
- VERSION = '5.5.0'
5
+ VERSION = '5.5.1'
6
6
 
7
7
  if RUBY_ENGINE == 'jruby'
8
8
  DEFAULT_SNAKEYAML_VERSION = '2.10'.freeze
@@ -48,7 +48,9 @@ module Psych
48
48
  end
49
49
  end
50
50
 
51
- result = deduplicate(result).freeze if @freeze
51
+ # Classes and modules named by !ruby/class and !ruby/module are shared
52
+ # by the whole process, not created by this load, so leave them alone.
53
+ result = deduplicate(result).freeze if @freeze && !(Module === result)
52
54
  result
53
55
  end
54
56
 
@@ -259,6 +261,12 @@ module Psych
259
261
  if klass
260
262
  string = klass.allocate.replace value
261
263
  else
264
+ # The value node can carry any tag, for example !ruby/class.
265
+ # Without this check the instance variables below would be
266
+ # set on whatever shared object that tag resolved to.
267
+ unless value.is_a?(String)
268
+ raise TypeError, "Invalid tag: expected a String for str, got #{value.class}"
269
+ end
262
270
  string = value
263
271
  end
264
272
  register(o, string)
@@ -274,7 +282,9 @@ module Psych
274
282
  members = Hash[o.children.map { |c| accept c }.each_slice(2).to_a]
275
283
  list.replace members['internal']
276
284
 
277
- members['ivars'].each do |ivar, v|
285
+ ivars = members['ivars']
286
+ class_loader.check_ivars(list) unless ivars.empty?
287
+ ivars.each do |ivar, v|
278
288
  list.instance_variable_set ivar, v
279
289
  end
280
290
  list
@@ -309,6 +319,7 @@ module Psych
309
319
  when 'elements'
310
320
  revive_hash hash, value
311
321
  when 'ivars'
322
+ class_loader.check_ivars(hash) unless value.children.empty?
312
323
  value.children.each_slice(2) do |k,v|
313
324
  hash.instance_variable_set accept(k), accept(v)
314
325
  end
@@ -457,6 +468,7 @@ module Psych
457
468
  if o.respond_to?(:init_with)
458
469
  o.init_with c
459
470
  else
471
+ class_loader.check_ivars(o) unless h.empty?
460
472
  h.each { |k,v| o.instance_variable_set(:"@#{k}", v) }
461
473
  end
462
474
  o
data/lib/psych.jar CHANGED
Binary file
data/lib/psych.rb CHANGED
@@ -296,6 +296,17 @@ module Psych
296
296
  #
297
297
  # Now the Date class can be loaded in addition to the classes listed above.
298
298
  #
299
+ # Instance variables are not restored on String or Hash objects unless
300
+ # String or Hash is listed in +permitted_classes+; otherwise a
301
+ # Psych::DisallowedInstanceVariables exception is raised.
302
+ #
303
+ # Permitting a class lets the YAML set arbitrary instance variables on
304
+ # instances of that class. Each new instance variable name creates a
305
+ # symbol that is never garbage collected, so untrusted input loaded with
306
+ # +permitted_classes+ can grow memory without bound. Validate untrusted
307
+ # YAML against a schema before loading it, for example with the
308
+ # yaml-schema gem (https://github.com/tenderlove/yaml-schema).
309
+ #
299
310
  # Aliases can be explicitly allowed by changing the +aliases+ keyword argument.
300
311
  # For example:
301
312
  #
metadata CHANGED
@@ -1,139 +1,145 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: psych
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.5.0
4
+ version: 5.5.1
5
5
  platform: java
6
6
  authors:
7
- - Aaron Patterson
8
- - SHIBATA Hiroshi
9
- - Charles Oliver Nutter
7
+ - Aaron Patterson
8
+ - SHIBATA Hiroshi
9
+ - Charles Oliver Nutter
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
  date: 1980-01-02 00:00:00.000000000 Z
13
13
  dependencies:
14
- - !ruby/object:Gem::Dependency
15
- name: jar-dependencies
16
- requirement: !ruby/object:Gem::Requirement
17
- requirements:
18
- - - ">="
19
- - !ruby/object:Gem::Version
20
- version: 0.1.7
21
- type: :runtime
22
- prerelease: false
23
- version_requirements: !ruby/object:Gem::Requirement
24
- requirements:
25
- - - ">="
26
- - !ruby/object:Gem::Version
27
- version: 0.1.7
28
- - !ruby/object:Gem::Dependency
29
- name: date
30
- requirement: !ruby/object:Gem::Requirement
31
- requirements:
32
- - - ">="
33
- - !ruby/object:Gem::Version
34
- version: '0'
35
- type: :runtime
36
- prerelease: false
37
- version_requirements: !ruby/object:Gem::Requirement
38
- requirements:
39
- - - ">="
40
- - !ruby/object:Gem::Version
41
- version: '0'
14
+ - !ruby/object:Gem::Dependency
15
+ name: jar-dependencies
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ -
19
+ - ">="
20
+ - !ruby/object:Gem::Version
21
+ version: 0.1.7
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ requirements:
26
+ -
27
+ - ">="
28
+ - !ruby/object:Gem::Version
29
+ version: 0.1.7
30
+ - !ruby/object:Gem::Dependency
31
+ name: date
32
+ requirement: !ruby/object:Gem::Requirement
33
+ requirements:
34
+ -
35
+ - ">="
36
+ - !ruby/object:Gem::Version
37
+ version: "0"
38
+ type: :runtime
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ requirements:
42
+ -
43
+ - ">="
44
+ - !ruby/object:Gem::Version
45
+ version: "0"
42
46
  description: |
43
47
  Psych is a YAML parser and emitter. Psych leverages libyaml[https://pyyaml.org/wiki/LibYAML]
44
48
  for its YAML parsing and emitting capabilities. In addition to wrapping libyaml,
45
49
  Psych also knows how to serialize and de-serialize most Ruby objects to and from the YAML format.
46
50
  email:
47
- - aaron@tenderlovemaking.com
48
- - hsbt@ruby-lang.org
49
- - headius@headius.com
51
+ - aaron@tenderlovemaking.com
52
+ - hsbt@ruby-lang.org
53
+ - headius@headius.com
50
54
  executables: []
51
55
  extensions: []
52
56
  extra_rdoc_files:
53
- - README.md
57
+ - README.md
54
58
  files:
55
- - CONTRIBUTING.md
56
- - LICENSE
57
- - README.md
58
- - ext/java/org/jruby/ext/psych/PsychEmitter.java
59
- - ext/java/org/jruby/ext/psych/PsychLibrary.java
60
- - ext/java/org/jruby/ext/psych/PsychParser.java
61
- - ext/java/org/jruby/ext/psych/PsychToRuby.java
62
- - ext/psych/depend
63
- - ext/psych/extconf.rb
64
- - ext/psych/psych.c
65
- - ext/psych/psych.h
66
- - ext/psych/psych_emitter.c
67
- - ext/psych/psych_emitter.h
68
- - ext/psych/psych_parser.c
69
- - ext/psych/psych_parser.h
70
- - ext/psych/psych_to_ruby.c
71
- - ext/psych/psych_to_ruby.h
72
- - ext/psych/psych_yaml_tree.c
73
- - ext/psych/psych_yaml_tree.h
74
- - lib/psych.jar
75
- - lib/psych.rb
76
- - lib/psych/class_loader.rb
77
- - lib/psych/coder.rb
78
- - lib/psych/core_ext.rb
79
- - lib/psych/exception.rb
80
- - lib/psych/handler.rb
81
- - lib/psych/handlers/document_stream.rb
82
- - lib/psych/handlers/recorder.rb
83
- - lib/psych/json/ruby_events.rb
84
- - lib/psych/json/stream.rb
85
- - lib/psych/json/tree_builder.rb
86
- - lib/psych/json/yaml_events.rb
87
- - lib/psych/nodes.rb
88
- - lib/psych/nodes/alias.rb
89
- - lib/psych/nodes/document.rb
90
- - lib/psych/nodes/mapping.rb
91
- - lib/psych/nodes/node.rb
92
- - lib/psych/nodes/scalar.rb
93
- - lib/psych/nodes/sequence.rb
94
- - lib/psych/nodes/stream.rb
95
- - lib/psych/omap.rb
96
- - lib/psych/parser.rb
97
- - lib/psych/scalar_scanner.rb
98
- - lib/psych/set.rb
99
- - lib/psych/stream.rb
100
- - lib/psych/streaming.rb
101
- - lib/psych/syntax_error.rb
102
- - lib/psych/tree_builder.rb
103
- - lib/psych/versions.rb
104
- - lib/psych/visitors.rb
105
- - lib/psych/visitors/depth_first.rb
106
- - lib/psych/visitors/emitter.rb
107
- - lib/psych/visitors/json_tree.rb
108
- - lib/psych/visitors/to_ruby.rb
109
- - lib/psych/visitors/visitor.rb
110
- - lib/psych/visitors/yaml_tree.rb
111
- - lib/psych/y.rb
112
- - lib/psych_jars.rb
113
- homepage: https://github.com/ruby/psych
59
+ - CONTRIBUTING.md
60
+ - LICENSE
61
+ - README.md
62
+ - ext/java/org/jruby/ext/psych/PsychEmitter.java
63
+ - ext/java/org/jruby/ext/psych/PsychLibrary.java
64
+ - ext/java/org/jruby/ext/psych/PsychParser.java
65
+ - ext/java/org/jruby/ext/psych/PsychToRuby.java
66
+ - ext/psych/depend
67
+ - ext/psych/extconf.rb
68
+ - ext/psych/psych.c
69
+ - ext/psych/psych.h
70
+ - ext/psych/psych_emitter.c
71
+ - ext/psych/psych_emitter.h
72
+ - ext/psych/psych_parser.c
73
+ - ext/psych/psych_parser.h
74
+ - ext/psych/psych_to_ruby.c
75
+ - ext/psych/psych_to_ruby.h
76
+ - ext/psych/psych_yaml_tree.c
77
+ - ext/psych/psych_yaml_tree.h
78
+ - lib/psych.jar
79
+ - lib/psych.rb
80
+ - lib/psych/class_loader.rb
81
+ - lib/psych/coder.rb
82
+ - lib/psych/core_ext.rb
83
+ - lib/psych/exception.rb
84
+ - lib/psych/handler.rb
85
+ - lib/psych/handlers/document_stream.rb
86
+ - lib/psych/handlers/recorder.rb
87
+ - lib/psych/json/ruby_events.rb
88
+ - lib/psych/json/stream.rb
89
+ - lib/psych/json/tree_builder.rb
90
+ - lib/psych/json/yaml_events.rb
91
+ - lib/psych/nodes.rb
92
+ - lib/psych/nodes/alias.rb
93
+ - lib/psych/nodes/document.rb
94
+ - lib/psych/nodes/mapping.rb
95
+ - lib/psych/nodes/node.rb
96
+ - lib/psych/nodes/scalar.rb
97
+ - lib/psych/nodes/sequence.rb
98
+ - lib/psych/nodes/stream.rb
99
+ - lib/psych/omap.rb
100
+ - lib/psych/parser.rb
101
+ - lib/psych/scalar_scanner.rb
102
+ - lib/psych/set.rb
103
+ - lib/psych/stream.rb
104
+ - lib/psych/streaming.rb
105
+ - lib/psych/syntax_error.rb
106
+ - lib/psych/tree_builder.rb
107
+ - lib/psych/versions.rb
108
+ - lib/psych/visitors.rb
109
+ - lib/psych/visitors/depth_first.rb
110
+ - lib/psych/visitors/emitter.rb
111
+ - lib/psych/visitors/json_tree.rb
112
+ - lib/psych/visitors/to_ruby.rb
113
+ - lib/psych/visitors/visitor.rb
114
+ - lib/psych/visitors/yaml_tree.rb
115
+ - lib/psych/y.rb
116
+ - lib/psych_jars.rb
117
+ homepage: "https://github.com/ruby/psych"
114
118
  licenses:
115
- - MIT
119
+ - MIT
116
120
  metadata:
117
121
  msys2_mingw_dependencies: libyaml
118
- changelog_uri: https://github.com/ruby/psych/releases
122
+ changelog_uri: "https://github.com/ruby/psych/releases"
119
123
  rdoc_options:
120
- - "--main"
121
- - README.md
124
+ - "--main"
125
+ - README.md
122
126
  require_paths:
123
- - lib
127
+ - lib
124
128
  required_ruby_version: !ruby/object:Gem::Requirement
125
129
  requirements:
126
- - - ">="
127
- - !ruby/object:Gem::Version
128
- version: 2.5.0
130
+ -
131
+ - ">="
132
+ - !ruby/object:Gem::Version
133
+ version: 2.5.0
129
134
  required_rubygems_version: !ruby/object:Gem::Requirement
130
135
  requirements:
131
- - - ">="
132
- - !ruby/object:Gem::Version
133
- version: '0'
136
+ -
137
+ - ">="
138
+ - !ruby/object:Gem::Version
139
+ version: "0"
134
140
  requirements:
135
- - jar org.snakeyaml:snakeyaml-engine, 2.10
136
- rubygems_version: 4.0.19
141
+ - "jar org.snakeyaml:snakeyaml-engine, 2.10"
142
+ rubygems_version: 4.1.1
137
143
  specification_version: 4
138
144
  summary: Psych is a YAML parser and emitter
139
145
  test_files: []