yeptris 0.6.18.1-powerpc64le-linux → 0.6.18.2-powerpc64le-linux

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: e9862df1f0e915266821b6203af43ca1a155a52087b1440d13b9cf3a60686df4
4
- data.tar.gz: 38f82776605059d138065f7716dfb9ea49c67e1cea744095f8d3d4bcfe4b661b
3
+ metadata.gz: acff06db51e1b2f75561cdf73ea0e73555687c81fbcd347cc622ac0ec6b68fd5
4
+ data.tar.gz: dd5ebf0312542655c8f85c25426746310e1acfd362a88ce0facde164a7690928
5
5
  SHA512:
6
- metadata.gz: 34ec5fc275de3c89442e0865db12fb7171afd1005ca724ce01e990e7e0d9eee043fdfea92bdbb7cf2fb1954c53e3c1baf096580ddfc36807a07c69dd44eeff02
7
- data.tar.gz: e905916fbcf703e8190327b00e0c3d909c8dd022cef1c9c35143797af564e5ab8c14cca81afe765f063971b55871d54807af13a421439d61679c920ea8c6d096
6
+ metadata.gz: 9cb10bafe45359a09efd903970613995b1665a6aa6137c1a5f8d1cd3b6d13cea142a01ac2061892e3d3ebcc1c003c17c9153aeddc54f196ced37f0ec3ef8eb46
7
+ data.tar.gz: 625deef05e540b5dfc35d73943324cf62f3fbf59a617d515dcf0499b8ef6950197c2907345dfa14083457a12299b954c93c64cc8f11f609856765c293fcd8b0e
data/lib/yeptris/cbor.rb CHANGED
@@ -121,7 +121,7 @@ module Yeptris
121
121
  def take_buffer(ptr, len_ptr)
122
122
  raise UnencodableError, ::Yeptris::FFI.last_error_message if ptr.null?
123
123
 
124
- len = len_ptr.read_uint64
124
+ len = Yeptris::FFI.read_c_size_t(len_ptr)
125
125
  ptr.read_bytes(len).force_encoding(Encoding::BINARY)
126
126
  ensure
127
127
  ::Yeptris::FFI.yeptris_free(ptr) if ptr && !ptr.null?
@@ -164,7 +164,7 @@ class Yeptris::Document
164
164
 
165
165
  def serialize(canonical: false, best_width: 0, explicit_doc_start: false)
166
166
  ensure_alive!
167
- len = ::FFI::MemoryPointer.new(:uint64)
167
+ len = ::FFI::MemoryPointer.new(:size_t)
168
168
  ptr =
169
169
  if canonical || best_width.positive? || explicit_doc_start
170
170
  opts = Yeptris::FFI::EmitOptions.new
@@ -180,13 +180,13 @@ class Yeptris::Document
180
180
  end
181
181
 
182
182
  def serialize_json_compact
183
- len = ::FFI::MemoryPointer.new(:uint64)
183
+ len = ::FFI::MemoryPointer.new(:size_t)
184
184
  Yeptris::FFI::Owned.string(Yeptris::FFI.yeptris_serialize_json_ex(@c_ptr, len, 1), len)
185
185
  end
186
186
 
187
187
  def serialize_json
188
188
  ensure_alive!
189
- len = ::FFI::MemoryPointer.new(:uint64)
189
+ len = ::FFI::MemoryPointer.new(:size_t)
190
190
  Yeptris::FFI::Owned.string(Yeptris::FFI.yeptris_serialize_json(@c_ptr, len), len)
191
191
  end
192
192
 
data/lib/yeptris/ffi.rb CHANGED
@@ -301,6 +301,17 @@ module Yeptris
301
301
  end
302
302
  end
303
303
 
304
+ # C out-params are size_t — native width (8 everywhere we ship
305
+ # except ILP32 armv7, where it is 4). The ffi gem (1.17.4) has no
306
+ # read_size_t, so dispatch on the measured type size: read_uint64
307
+ # on a 4-byte :size_t buffer ran out of bounds on arm-linux (the
308
+ # 0.6.18.1 armv7 smoke, valueml.rb:118).
309
+ SIZE_T_WIDTH = ::FFI.type_size(:size_t)
310
+
311
+ def self.read_c_size_t(ptr)
312
+ SIZE_T_WIDTH == 8 ? ptr.read_uint64 : ptr.read_uint32
313
+ end
314
+
304
315
  module Owned
305
316
  module_function
306
317
 
@@ -310,7 +321,7 @@ module Yeptris
310
321
  def string(ptr, len_out = nil)
311
322
  return nil if ptr.null?
312
323
 
313
- len = len_out&.read_uint64
324
+ len = len_out && Yeptris::FFI.read_c_size_t(len_out)
314
325
  s = if len && len > 0
315
326
  ptr.read_bytes(len).force_encoding(Encoding::UTF_8)
316
327
  else
@@ -78,10 +78,10 @@ module Yeptris
78
78
  end
79
79
  count_p = ::FFI::MemoryPointer.new(:size_t)
80
80
  records = Yeptris::FFI.yeptris_recorder_records(rec, count_p)
81
- count = count_p.read_uint64
81
+ count = Yeptris::FFI.read_c_size_t(count_p)
82
82
  arena_len = ::FFI::MemoryPointer.new(:size_t)
83
83
  arena_ptr = Yeptris::FFI.yeptris_recorder_arena(rec, arena_len)
84
- arena_len_v = arena_len.read_uint64
84
+ arena_len_v = Yeptris::FFI.read_c_size_t(arena_len)
85
85
  arena = arena_ptr.null? || arena_len_v.zero? ? +"" : arena_ptr.read_bytes(arena_len_v)
86
86
  flat = records.read_bytes(count * RECORD_SIZE)
87
87
  .unpack(RECORD_UNPACK * count)
data/lib/yeptris/node.rb CHANGED
@@ -50,11 +50,11 @@ class Yeptris::Node
50
50
 
51
51
  # Scalar content / alias name (UTF-8 String), nil for collections.
52
52
  def value
53
- len = ::FFI::MemoryPointer.new(:uint64)
53
+ len = ::FFI::MemoryPointer.new(:size_t)
54
54
  ptr = alive { Yeptris::FFI.yeptris_node_value(@c_ptr, len) }
55
55
  return nil if ptr.null?
56
56
 
57
- ptr.read_bytes(len.read_uint64).force_encoding(Encoding::UTF_8)
57
+ ptr.read_bytes(Yeptris::FFI.read_c_size_t(len)).force_encoding(Encoding::UTF_8)
58
58
  end
59
59
 
60
60
  STYLES = {
@@ -71,19 +71,19 @@ class Yeptris::Node
71
71
 
72
72
  # Explicit tag URI when present, else nil.
73
73
  def tag
74
- len = ::FFI::MemoryPointer.new(:uint64)
74
+ len = ::FFI::MemoryPointer.new(:size_t)
75
75
  ptr = alive { Yeptris::FFI.yeptris_node_tag(@c_ptr, len) }
76
76
  return nil if ptr.null?
77
77
 
78
- ptr.read_bytes(len.read_uint64).force_encoding(Encoding::UTF_8)
78
+ ptr.read_bytes(Yeptris::FFI.read_c_size_t(len)).force_encoding(Encoding::UTF_8)
79
79
  end
80
80
 
81
81
  def anchor
82
- len = ::FFI::MemoryPointer.new(:uint64)
82
+ len = ::FFI::MemoryPointer.new(:size_t)
83
83
  ptr = alive { Yeptris::FFI.yeptris_node_anchor(@c_ptr, len) }
84
84
  return nil if ptr.null?
85
85
 
86
- ptr.read_bytes(len.read_uint64).force_encoding(Encoding::UTF_8)
86
+ ptr.read_bytes(Yeptris::FFI.read_c_size_t(len)).force_encoding(Encoding::UTF_8)
87
87
  end
88
88
 
89
89
  def alias_target
@@ -293,7 +293,7 @@ class Yeptris::Node
293
293
  elsif st != Yeptris::FFI::OK
294
294
  raise Yeptris::ParseError, Yeptris::FFI.last_error_message
295
295
  else
296
- bytes = out_p.read_pointer.read_bytes(olen_p.read_uint64)
296
+ bytes = out_p.read_pointer.read_bytes(Yeptris::FFI.read_c_size_t(olen_p))
297
297
  bytes.force_encoding(Encoding::ASCII_8BIT)
298
298
  ::Marshal.load(bytes)
299
299
  end
@@ -38,9 +38,9 @@ module Yeptris
38
38
  yaml = Yeptris.read_input(yaml)
39
39
  yaml = yaml.to_s
40
40
  vals_p = ::FFI::MemoryPointer.new(:pointer)
41
- count_p = ::FFI::MemoryPointer.new(:uint64)
41
+ count_p = ::FFI::MemoryPointer.new(:size_t)
42
42
  arena_p = ::FFI::MemoryPointer.new(:pointer)
43
- alen_p = ::FFI::MemoryPointer.new(:uint64)
43
+ alen_p = ::FFI::MemoryPointer.new(:size_t)
44
44
  st = FFI.yeptris_value_drain(
45
45
  yaml, yaml.bytesize,
46
46
  schema == :compat_11 ? FFI::SCHEMA_11_COMPAT : FFI::SCHEMA_12_CORE,
@@ -51,9 +51,9 @@ module Yeptris
51
51
  vals = vals_p.read_pointer
52
52
  arena = arena_p.read_pointer
53
53
  begin
54
- count = count_p.read_uint64
54
+ count = Yeptris::FFI.read_c_size_t(count_p)
55
55
  flat = vals.read_bytes(count * VALUE_SIZE).unpack(UNPACK * count)
56
- arena_bytes = arena.read_bytes(alen_p.read_uint64)
56
+ arena_bytes = arena.read_bytes(Yeptris::FFI.read_c_size_t(alen_p))
57
57
  arena_bytes.force_encoding(Encoding::UTF_8)
58
58
  walk(flat, arena_bytes, schema == :compat_11)
59
59
  ensure
@@ -115,7 +115,7 @@ module Yeptris
115
115
  return nil if st == FFI::ERROR_UNSUPPORTED
116
116
  raise ParseError, FFI.last_error_message if st != FFI::OK
117
117
  buf = out_p.read_pointer
118
- len = olen_p.read_uint64
118
+ len = Yeptris::FFI.read_c_size_t(olen_p)
119
119
  bytes = buf.read_bytes(len)
120
120
  bytes.force_encoding(Encoding::ASCII_8BIT)
121
121
  ::Marshal.load(bytes)
data/lib/yeptris.rb CHANGED
@@ -3,7 +3,7 @@
3
3
  module Yeptris
4
4
  # The gem's version lives in the parent namespace's file — the last
5
5
  # internal require (yeptris/version) retired with it.
6
- VERSION = "0.6.18.1".freeze
6
+ VERSION = "0.6.18.2".freeze
7
7
  # The error hierarchy lives in THIS file (the parent namespace's
8
8
  # own file): nested constants do not trigger a parent-constant
9
9
  # autoload, and the law forbids internal requires — defining the
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yeptris
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.18.1
4
+ version: 0.6.18.2
5
5
  platform: powerpc64le-linux
6
6
  authors:
7
7
  - Ribose Inc.