psych 5.3.1 → 5.4.0

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: ec86c3f6651b1fada82948d0eedf7b90e793b5009000cd1339f59625bea67099
4
- data.tar.gz: 21add9c5d592cef7b4e2c1510d7f73ef038dd67d96aada5b42c689e1b70bf343
3
+ metadata.gz: 289d2a9532c36be34f187b80d36eb98ebac368da3539a44e8e6e291bc7f184eb
4
+ data.tar.gz: d717de45e2a5519d4a2c27a26a2e1aed7269e1c80b5213a19c070f1d56712a03
5
5
  SHA512:
6
- metadata.gz: 5a72478d1e959e4d226dbee171299753064d3714b0d07f222b1aba87d0dc45de82c8f88b3c70e70c55da64017313bc143676a76f64ffd30423d5740396bbed46
7
- data.tar.gz: fd64458ae3b633ac079bec30a94bef77bca75b694f93f4d3dae37da35ec49911e46de7d1ce871e1665e3da8570fa01f5616722a5b064a649d7186d8d74305380
6
+ metadata.gz: d00bc06b2fd173ea66dbb8f7b5a5ad75ad6074eff6f011d9d9774ef33662a0c0e642f0dd4daa67776b1a89fdb54854932809351b12052eea00c69b9499792639
7
+ data.tar.gz: 27428cdb1bce30907b2654310632967274e1bb2dd43a5a7e634577cf797911b4931b4165e57c8e6545e08f1e9c9979be18600ed3d9a589e52d7df5360b7689f3
data/README.md CHANGED
@@ -26,8 +26,8 @@ Psych.dump("foo") # => "--- foo\n...\n"
26
26
 
27
27
  ## Installation
28
28
 
29
- Psych has been included with MRI since 1.9.2, and is the default YAML parser
30
- in 1.9.3.
29
+ Psych has been included with MRI since 1.9.2, and has been the default YAML parser
30
+ since 1.9.3.
31
31
 
32
32
  If you want a newer gem release of Psych, you can use RubyGems:
33
33
 
@@ -32,9 +32,20 @@ static int io_reader(void * data, unsigned char *buf, size_t size, size_t *read)
32
32
  *read = 0;
33
33
 
34
34
  if(! NIL_P(string)) {
35
- void * str = (void *)StringValuePtr(string);
36
- *read = (size_t)RSTRING_LEN(string);
37
- memcpy(buf, str, *read);
35
+ char * str = StringValuePtr(string);
36
+ size_t len = (size_t)RSTRING_LEN(string);
37
+
38
+ /* IO#read(size) is documented to return at most `size` bytes, but a
39
+ * misbehaving IO-like object may return more. Clamp the copy to the
40
+ * buffer libyaml gave us to avoid writing past its end, rounding down
41
+ * to a character boundary so a multibyte character is never split. */
42
+ if(len > size) {
43
+ rb_encoding * enc = rb_enc_get(string);
44
+ len = (size_t)(rb_enc_left_char_head(str, str + size, str + len, enc) - str);
45
+ }
46
+
47
+ *read = len;
48
+ memcpy(buf, str, len);
38
49
  }
39
50
 
40
51
  return 1;
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Psych
4
4
  # The version of Psych you are using
5
- VERSION = '5.3.1'
5
+ VERSION = '5.4.0'
6
6
 
7
7
  if RUBY_ENGINE == 'jruby'
8
8
  DEFAULT_SNAKEYAML_VERSION = '2.10'.freeze
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: psych
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.3.1
4
+ version: 5.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aaron Patterson