msgpack 1.8.3 → 1.8.5

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: ed5705d96741dbe59f61d59de79d133dfead8636cbf8c9db51b684c425a52e34
4
- data.tar.gz: 6fa2a89acb1a2ae0db5068fa59b483d2292e0b9ad681f9c3c058cf164dd28385
3
+ metadata.gz: 9a5462dff41bc8885570f42b59092d6e02729500a9a873aa15ead68ed8872ccb
4
+ data.tar.gz: 3fcc99b85b8ece0dd0158f2ee511784a789f41ab9d3bafd9f6fc006ccd3b9061
5
5
  SHA512:
6
- metadata.gz: 8edfe983aaee5230a1c1547e45894403c9c4435a65bbe4d88b4e9a800bb31467ad867526f4d54baf2cd6b7738cd9458104fc0caa772bba0dcbcb25c427002218
7
- data.tar.gz: 3d282debd040b4f9b0f2a15c2c34068b64d01c696d1756f235c63078e54d5fcc2d1896f1b32321aa2c70ec67b8205eb608e841aff60eecd78a651e614016eac3
6
+ metadata.gz: 3cb8969960d3d2de3beb39503cb33259ac169f27397d75f981a2563bf14700e4359ca30f2fc6357bf848b707546dc0c692385250c186496e2ef7d5546809bab3
7
+ data.tar.gz: 5cb7b9154e12839ee504c5630d3cee504558206ea63fb54236fc7433191a763267a7fce29a43157d59507f0cc1d4b5b88ba62607571ce98ca1175aa911c1c338
data/ChangeLog CHANGED
@@ -1,3 +1,16 @@
1
+ 2026-09-11 1.8.5
2
+
3
+ * Prevent stack depth underflow when skipping from recursive unpacker.
4
+ * Fix `Unpacker#skip_nil` to properly consume the buffer.
5
+ * Fix some small difference in Factory registration of the Java implementation.
6
+ * Fix some Factory/ext_type optimization edge cases.
7
+
8
+ 2026-07-28 1.8.4
9
+
10
+ * Fix `MessagePack::Buffer` to stop using already released memory page.
11
+ This could have caused data to leak across buffers when using the MessagePack::Buffer API
12
+ directly.
13
+
1
14
  2026-06-10 1.8.3
2
15
 
3
16
  * Fix an integer overflow when parsing maps.
@@ -6,7 +19,7 @@
6
19
 
7
20
  * Fix `Buffer#clear` to properly reset memory chunks before adding them back to the pool.
8
21
  This could have caused data to leak across buffers when using the MessagePack::Buffer API
9
- directly. [CVE-PENDING].
22
+ directly. [CVE-2026-54522].
10
23
 
11
24
  2026-05-28 1.8.1
12
25
 
@@ -59,6 +59,7 @@ public class Factory extends RubyObject {
59
59
  Factory clone = (Factory)super.dup();
60
60
  clone.extensionRegistry = extensionRegistry();
61
61
  clone.hasSymbolExtType = hasSymbolExtType;
62
+ clone.hasBigIntExtType = hasBigIntExtType;
62
63
  return clone;
63
64
  }
64
65
 
@@ -110,8 +111,8 @@ public class Factory extends RubyObject {
110
111
 
111
112
  extensionRegistry.put(extModule, (int) typeId, recursive, packerProc, unpackerProc);
112
113
 
113
- if (extModule == runtime.getSymbol() && !packerProc.isNil()) {
114
- hasSymbolExtType = true;
114
+ if (extModule == runtime.getSymbol()) {
115
+ hasSymbolExtType = packerProc != null && !packerProc.isNil();
115
116
  }
116
117
 
117
118
  if (options != null) {
@@ -122,6 +123,8 @@ public class Factory extends RubyObject {
122
123
  } else {
123
124
  throw runtime.newArgumentError("oversized_integer_extension: true is only for Integer class");
124
125
  }
126
+ } else if (extModule == runtime.getModule("Integer")) {
127
+ hasBigIntExtType = false;
125
128
  }
126
129
  }
127
130
 
data/ext/msgpack/buffer.c CHANGED
@@ -127,6 +127,15 @@ void msgpack_buffer_mark(void *ptr)
127
127
 
128
128
  bool _msgpack_buffer_shift_chunk(msgpack_buffer_t* b)
129
129
  {
130
+ if(b->rmem_owner == &b->head->mem) {
131
+ /* the chunk that owns the rmem page is going away and takes the page
132
+ * with it. don't carve the remaining space out of a page that is
133
+ * already back in the pool. */
134
+ b->rmem_end = NULL;
135
+ b->rmem_last = NULL;
136
+ b->rmem_owner = NULL;
137
+ }
138
+
130
139
  _msgpack_buffer_chunk_destroy(b->head);
131
140
 
132
141
  if(b->head == &b->tail) {
@@ -264,6 +273,18 @@ static inline msgpack_buffer_chunk_t* _msgpack_buffer_alloc_new_chunk(msgpack_bu
264
273
  return chunk;
265
274
  }
266
275
 
276
+ /* b->tail is copied into nc and then rebuilt, so the rmem page pointer moves
277
+ * to nc. the owner has to follow it: if it kept pointing at b->tail.mem, the
278
+ * transfer in _msgpack_buffer_chunk_malloc would degenerate into a
279
+ * self-assignment and the page would be released by nc while the rebuilt tail
280
+ * is still reading from it. */
281
+ static inline void _msgpack_buffer_transfer_rmem_owner(msgpack_buffer_t* b, msgpack_buffer_chunk_t* nc)
282
+ {
283
+ if(b->rmem_owner == &b->tail.mem) {
284
+ b->rmem_owner = &nc->mem;
285
+ }
286
+ }
287
+
267
288
  static inline void _msgpack_buffer_add_new_chunk(msgpack_buffer_t* b)
268
289
  {
269
290
  if(b->head == &b->tail) {
@@ -275,6 +296,7 @@ static inline void _msgpack_buffer_add_new_chunk(msgpack_buffer_t* b)
275
296
  msgpack_buffer_chunk_t* nc = _msgpack_buffer_alloc_new_chunk(b);
276
297
 
277
298
  *nc = b->tail;
299
+ _msgpack_buffer_transfer_rmem_owner(b, nc);
278
300
  b->head = nc;
279
301
  nc->next = &b->tail;
280
302
 
@@ -295,6 +317,7 @@ static inline void _msgpack_buffer_add_new_chunk(msgpack_buffer_t* b)
295
317
 
296
318
  /* rebuild tail */
297
319
  *nc = b->tail;
320
+ _msgpack_buffer_transfer_rmem_owner(b, nc);
298
321
  before_tail->next = nc;
299
322
  nc->next = &b->tail;
300
323
  }
@@ -121,7 +121,10 @@ static VALUE Factory_dup(VALUE self)
121
121
  msgpack_factory_t *fc = Factory_get(self);
122
122
  msgpack_factory_t *cloned_fc = Factory_get(clone);
123
123
 
124
+ cloned_fc->has_bigint_ext_type = fc->has_bigint_ext_type;
124
125
  cloned_fc->has_symbol_ext_type = fc->has_symbol_ext_type;
126
+ cloned_fc->optimized_symbol_ext_type = fc->optimized_symbol_ext_type;
127
+ cloned_fc->symbol_ext_type = fc->symbol_ext_type;
125
128
  cloned_fc->pkrg = fc->pkrg;
126
129
  msgpack_unpacker_ext_registry_borrow(fc->ukrg, &cloned_fc->ukrg);
127
130
  msgpack_packer_ext_registry_dup(clone, &fc->pkrg, &cloned_fc->pkrg);
@@ -230,12 +233,13 @@ static VALUE Factory_register_type_internal(VALUE self, VALUE rb_ext_type, VALUE
230
233
  }
231
234
 
232
235
  if(ext_module == rb_cSymbol) {
233
- if(NIL_P(options) || RTEST(rb_hash_aref(options, ID2SYM(rb_intern("packer"))))) {
234
- fc->has_symbol_ext_type = true;
235
- }
236
- if(RTEST(options) && RTEST(rb_hash_aref(options, ID2SYM(rb_intern("optimized_symbols_parsing"))))) {
237
- fc->optimized_symbol_ext_type = true;
238
- }
236
+ fc->symbol_ext_type = ext_type;
237
+ fc->has_symbol_ext_type = NIL_P(options) || RTEST(packer_proc);
238
+ fc->optimized_symbol_ext_type = RTEST(options) && RTEST(rb_hash_aref(options, ID2SYM(rb_intern("optimized_symbols_parsing"))));
239
+ }
240
+
241
+ if(ext_module == rb_cInteger) {
242
+ fc->has_bigint_ext_type = false;
239
243
  }
240
244
 
241
245
  if(RTEST(options)) {
@@ -246,7 +250,6 @@ static VALUE Factory_register_type_internal(VALUE self, VALUE rb_ext_type, VALUE
246
250
  rb_raise(rb_eArgError, "oversized_integer_extension: true is only for Integer class");
247
251
  }
248
252
  }
249
-
250
253
  if(RTEST(rb_hash_aref(options, ID2SYM(rb_intern("recursive"))))) {
251
254
  flags |= MSGPACK_EXT_RECURSIVE;
252
255
  }
data/ext/msgpack/packer.h CHANGED
@@ -25,11 +25,6 @@
25
25
  #define MSGPACK_PACKER_IO_FLUSH_THRESHOLD_TO_WRITE_STRING_BODY (1024)
26
26
  #endif
27
27
 
28
- #ifndef UNREACHABLE_RETURN
29
- // Ruby 2.5
30
- #define UNREACHABLE_RETURN() return
31
- #endif
32
-
33
28
  struct msgpack_packer_t;
34
29
  typedef struct msgpack_packer_t msgpack_packer_t;
35
30
 
@@ -418,7 +413,6 @@ static inline void msgpack_packer_write_string_value(msgpack_packer_t* pk, VALUE
418
413
 
419
414
  if(RB_UNLIKELY(len > 0xffffffffL)) {
420
415
  rb_raise(rb_eArgError, "size of string is too long to pack: %lu bytes should be <= %ld", len, 0xffffffffL);
421
- UNREACHABLE_RETURN();
422
416
  }
423
417
 
424
418
  if (RB_UNLIKELY(pk->compatibility_mode)) {
@@ -235,7 +235,7 @@ static VALUE Packer_write_extension(VALUE self, VALUE obj)
235
235
 
236
236
  VALUE rb_ext_type = RSTRUCT_GET(obj, 0);
237
237
  if(!RB_TYPE_P(rb_ext_type, T_FIXNUM)) {
238
- rb_raise(rb_eRangeError, "integer %s too big to convert to `signed char'", RSTRING_PTR(rb_String(rb_ext_type)));
238
+ rb_raise(rb_eRangeError, "integer %"PRIsVALUE" too big to convert to `signed char'", rb_ext_type);
239
239
  }
240
240
 
241
241
  int ext_type = FIX2INT(rb_ext_type);
@@ -211,7 +211,7 @@ static inline int object_complete(msgpack_unpacker_t* uk, VALUE object)
211
211
  return PRIMITIVE_OBJECT_COMPLETE;
212
212
  }
213
213
 
214
- static inline int object_complete_symbol(msgpack_unpacker_t* uk, VALUE object)
214
+ static inline int object_complete_frozen(msgpack_unpacker_t* uk, VALUE object)
215
215
  {
216
216
  uk->last_object = object;
217
217
  reset_head_byte(uk);
@@ -222,9 +222,9 @@ static inline int object_complete_ext(msgpack_unpacker_t* uk, int ext_type, VALU
222
222
  {
223
223
  if (uk->optimized_symbol_ext_type && ext_type == uk->symbol_ext_type) {
224
224
  if (RB_UNLIKELY(NIL_P(str))) { // empty extension is returned as Qnil
225
- return object_complete_symbol(uk, ID2SYM(rb_intern3("", 0, rb_utf8_encoding())));
225
+ return object_complete_frozen(uk, ID2SYM(rb_intern3("", 0, rb_utf8_encoding())));
226
226
  }
227
- return object_complete_symbol(uk, rb_str_intern(str));
227
+ return object_complete_frozen(uk, rb_str_intern(str));
228
228
  }
229
229
 
230
230
  int ext_flags;
@@ -378,10 +378,23 @@ static inline int read_raw_body_begin(msgpack_unpacker_t* uk, int raw_type)
378
378
  reset_head_byte(uk);
379
379
  uk->reading_raw_remaining = 0;
380
380
 
381
- _msgpack_unpacker_stack_push(uk, STACK_TYPE_RECURSIVE, 1, Qnil);
381
+ if(_msgpack_unpacker_stack_push(uk, STACK_TYPE_RECURSIVE, 1, Qnil) < 0) {
382
+ /* Recursive extensions re-enter msgpack_unpacker_read() through the
383
+ * user proc, consuming a full C stack frame per nesting level. If we
384
+ * ignore a failed push (stack already at MSGPACK_UNPACKER_STACK_CAPACITY)
385
+ * the recursion continues unbounded and exhausts the C stack (SIGSEGV)
386
+ * instead of raising StackError like every other container type. */
387
+ return PRIMITIVE_STACK_TOO_DEEP;
388
+ }
389
+ size_t barrier_depth = uk->stack.depth;
382
390
  int raised;
383
391
  obj = protected_proc_call(proc, 1, &uk->self, &raised);
384
- msgpack_unpacker_stack_pop(uk);
392
+
393
+ /* The user proc can drive the unpacker itself (Unpacker#read, #skip,
394
+ * or a rescued error) and leave stack.depth anywhere, including 0.
395
+ * Restore it to just below the barrier we pushed instead of an
396
+ * unconditional decrement, which would underflow to SIZE_MAX. */
397
+ uk->stack.depth = barrier_depth - 1;
385
398
 
386
399
  if (raised) {
387
400
  uk->last_object = rb_errinfo();
@@ -398,7 +411,7 @@ static inline int read_raw_body_begin(msgpack_unpacker_t* uk, int raw_type)
398
411
  int ret;
399
412
  if ((uk->optimized_symbol_ext_type && uk->symbol_ext_type == raw_type)) {
400
413
  VALUE symbol = msgpack_buffer_read_top_as_symbol(UNPACKER_BUFFER_(uk), length, raw_type != RAW_TYPE_BINARY);
401
- ret = object_complete_symbol(uk, symbol);
414
+ ret = object_complete_frozen(uk, symbol);
402
415
  } else if (is_reading_map_key(uk) && raw_type == RAW_TYPE_STRING) {
403
416
  /* don't use zerocopy for hash keys but get a frozen string directly
404
417
  * because rb_hash_aset freezes keys and it causes copying */
@@ -409,7 +422,7 @@ static inline int read_raw_body_begin(msgpack_unpacker_t* uk, int raw_type)
409
422
  } else {
410
423
  key = msgpack_buffer_read_top_as_symbol(UNPACKER_BUFFER_(uk), length, true);
411
424
  }
412
- ret = object_complete_symbol(uk, key);
425
+ ret = object_complete_frozen(uk, key);
413
426
  } else {
414
427
  if (uk->use_key_cache) {
415
428
  key = msgpack_buffer_read_top_as_interned_string(UNPACKER_BUFFER_(uk), &uk->key_cache, length);
@@ -450,10 +463,10 @@ static int read_primitive(msgpack_unpacker_t* uk)
450
463
 
451
464
  SWITCH_RANGE_BEGIN(b)
452
465
  SWITCH_RANGE(b, 0x00, 0x7f) // Positive Fixnum
453
- return object_complete(uk, INT2NUM(b));
466
+ return object_complete_frozen(uk, INT2NUM(b));
454
467
 
455
468
  SWITCH_RANGE(b, 0xe0, 0xff) // Negative Fixnum
456
- return object_complete(uk, INT2NUM((int8_t)b));
469
+ return object_complete_frozen(uk, INT2NUM((int8_t)b));
457
470
 
458
471
  SWITCH_RANGE(b, 0xa0, 0xbf) // FixRaw / fixstr
459
472
  size_t count = b & 0x1f;
@@ -478,15 +491,15 @@ static int read_primitive(msgpack_unpacker_t* uk)
478
491
  SWITCH_RANGE(b, 0xc0, 0xdf) // Variable
479
492
  switch(b) {
480
493
  case 0xc0: // nil
481
- return object_complete(uk, Qnil);
494
+ return object_complete_frozen(uk, Qnil);
482
495
 
483
496
  //case 0xc1: // string
484
497
 
485
498
  case 0xc2: // false
486
- return object_complete(uk, Qfalse);
499
+ return object_complete_frozen(uk, Qfalse);
487
500
 
488
501
  case 0xc3: // true
489
- return object_complete(uk, Qtrue);
502
+ return object_complete_frozen(uk, Qtrue);
490
503
 
491
504
  case 0xc7: // ext 8
492
505
  {
@@ -542,14 +555,14 @@ static int read_primitive(msgpack_unpacker_t* uk)
542
555
  {
543
556
  READ_CAST_BLOCK_OR_RETURN_EOF(cb, uk, 1);
544
557
  uint8_t u8 = cb.u8;
545
- return object_complete(uk, INT2NUM((int)u8));
558
+ return object_complete_frozen(uk, INT2NUM((int)u8));
546
559
  }
547
560
 
548
561
  case 0xcd: // unsigned int 16
549
562
  {
550
563
  READ_CAST_BLOCK_OR_RETURN_EOF(cb, uk, 2);
551
564
  uint16_t u16 = _msgpack_be16(cb.u16);
552
- return object_complete(uk, INT2NUM((int)u16));
565
+ return object_complete_frozen(uk, INT2NUM((int)u16));
553
566
  }
554
567
 
555
568
  case 0xce: // unsigned int 32
@@ -570,14 +583,14 @@ static int read_primitive(msgpack_unpacker_t* uk)
570
583
  {
571
584
  READ_CAST_BLOCK_OR_RETURN_EOF(cb, uk, 1);
572
585
  int8_t i8 = cb.i8;
573
- return object_complete(uk, INT2NUM((int)i8));
586
+ return object_complete_frozen(uk, INT2NUM((int)i8));
574
587
  }
575
588
 
576
589
  case 0xd1: // signed int 16
577
590
  {
578
591
  READ_CAST_BLOCK_OR_RETURN_EOF(cb, uk, 2);
579
592
  int16_t i16 = _msgpack_be16(cb.i16);
580
- return object_complete(uk, INT2NUM((int)i16));
593
+ return object_complete_frozen(uk, INT2NUM((int)i16));
581
594
  }
582
595
 
583
596
  case 0xd2: // signed int 32
@@ -897,82 +910,6 @@ int msgpack_unpacker_skip(msgpack_unpacker_t* uk, size_t target_stack_depth)
897
910
  }
898
911
  }
899
912
 
900
- int msgpack_unpacker_peek_next_object_type(msgpack_unpacker_t* uk)
901
- {
902
- int b = get_head_byte(uk);
903
- if(b < 0) {
904
- return b;
905
- }
906
-
907
- SWITCH_RANGE_BEGIN(b)
908
- SWITCH_RANGE(b, 0x00, 0x7f) // Positive Fixnum
909
- return TYPE_INTEGER;
910
-
911
- SWITCH_RANGE(b, 0xe0, 0xff) // Negative Fixnum
912
- return TYPE_INTEGER;
913
-
914
- SWITCH_RANGE(b, 0xa0, 0xbf) // FixRaw
915
- return TYPE_RAW;
916
-
917
- SWITCH_RANGE(b, 0x90, 0x9f) // FixArray
918
- return TYPE_ARRAY;
919
-
920
- SWITCH_RANGE(b, 0x80, 0x8f) // FixMap
921
- return TYPE_MAP;
922
-
923
- SWITCH_RANGE(b, 0xc0, 0xdf) // Variable
924
- switch(b) {
925
- case 0xc0: // nil
926
- return TYPE_NIL;
927
-
928
- case 0xc2: // false
929
- case 0xc3: // true
930
- return TYPE_BOOLEAN;
931
-
932
- case 0xca: // float
933
- case 0xcb: // double
934
- return TYPE_FLOAT;
935
-
936
- case 0xcc: // unsigned int 8
937
- case 0xcd: // unsigned int 16
938
- case 0xce: // unsigned int 32
939
- case 0xcf: // unsigned int 64
940
- return TYPE_INTEGER;
941
-
942
- case 0xd0: // signed int 8
943
- case 0xd1: // signed int 16
944
- case 0xd2: // signed int 32
945
- case 0xd3: // signed int 64
946
- return TYPE_INTEGER;
947
-
948
- case 0xd9: // raw 8 / str 8
949
- case 0xda: // raw 16 / str 16
950
- case 0xdb: // raw 32 / str 32
951
- return TYPE_RAW;
952
-
953
- case 0xc4: // bin 8
954
- case 0xc5: // bin 16
955
- case 0xc6: // bin 32
956
- return TYPE_RAW;
957
-
958
- case 0xdc: // array 16
959
- case 0xdd: // array 32
960
- return TYPE_ARRAY;
961
-
962
- case 0xde: // map 16
963
- case 0xdf: // map 32
964
- return TYPE_MAP;
965
-
966
- default:
967
- return PRIMITIVE_INVALID_BYTE;
968
- }
969
-
970
- SWITCH_RANGE_DEFAULT
971
- return PRIMITIVE_INVALID_BYTE;
972
-
973
- SWITCH_RANGE_END
974
- }
975
-
976
913
  int msgpack_unpacker_skip_nil(msgpack_unpacker_t* uk)
977
914
  {
978
915
  int b = get_head_byte(uk);
@@ -980,8 +917,8 @@ int msgpack_unpacker_skip_nil(msgpack_unpacker_t* uk)
980
917
  return b;
981
918
  }
982
919
  if(b == 0xc0) {
920
+ reset_head_byte(uk);
983
921
  return 1;
984
922
  }
985
923
  return 0;
986
924
  }
987
-
@@ -77,16 +77,6 @@ struct msgpack_unpacker_t {
77
77
 
78
78
  #define UNPACKER_BUFFER_(uk) (&(uk)->buffer)
79
79
 
80
- enum msgpack_unpacker_object_type {
81
- TYPE_NIL = 0,
82
- TYPE_BOOLEAN,
83
- TYPE_INTEGER,
84
- TYPE_FLOAT,
85
- TYPE_RAW,
86
- TYPE_ARRAY,
87
- TYPE_MAP,
88
- };
89
-
90
80
  void msgpack_unpacker_static_init(void);
91
81
 
92
82
  void msgpack_unpacker_static_destroy(void);
@@ -139,9 +129,6 @@ static inline VALUE msgpack_unpacker_get_last_object(msgpack_unpacker_t* uk)
139
129
  return uk->last_object;
140
130
  }
141
131
 
142
-
143
- int msgpack_unpacker_peek_next_object_type(msgpack_unpacker_t* uk);
144
-
145
132
  int msgpack_unpacker_skip_nil(msgpack_unpacker_t* uk);
146
133
 
147
134
  int msgpack_unpacker_read_array_header(msgpack_unpacker_t* uk, uint32_t* result_size);
@@ -14,10 +14,12 @@ module MessagePack
14
14
  options[:packer] = packer.to_sym.to_proc
15
15
  when Method
16
16
  options[:packer] = packer.to_proc
17
- when packer.respond_to?(:call)
18
- options[:packer] = packer.method(:call).to_proc
19
17
  else
20
- raise ::TypeError, "expected :packer argument to be a callable object, got: #{packer.inspect}"
18
+ if packer.respond_to?(:call)
19
+ options[:packer] = packer.method(:call).to_proc
20
+ else
21
+ raise ::TypeError, "expected :packer argument to be a callable object, got: #{packer.inspect}"
22
+ end
21
23
  end
22
24
 
23
25
  case unpacker = options[:unpacker]
@@ -27,10 +29,12 @@ module MessagePack
27
29
  options[:unpacker] = klass.method(unpacker).to_proc
28
30
  when Method
29
31
  options[:unpacker] = unpacker.to_proc
30
- when packer.respond_to?(:call)
31
- options[:unpacker] = unpacker.method(:call).to_proc
32
32
  else
33
- raise ::TypeError, "expected :unpacker argument to be a callable object, got: #{unpacker.inspect}"
33
+ if unpacker.respond_to?(:call)
34
+ options[:unpacker] = unpacker.method(:call).to_proc
35
+ else
36
+ raise ::TypeError, "expected :unpacker argument to be a callable object, got: #{unpacker.inspect}"
37
+ end
34
38
  end
35
39
  end
36
40
 
@@ -51,7 +55,7 @@ module MessagePack
51
55
  type = ary[0]
52
56
  packer_proc = ary[1]
53
57
  unpacker_proc = nil
54
- if unpacker.has_key?(type)
58
+ if unpacker.has_key?(type) && unpacker[type][0] == klass
55
59
  unpacker_proc = unpacker.delete(type)[1]
56
60
  end
57
61
  list << {type: type, class: klass, packer: packer_proc, unpacker: unpacker_proc}
@@ -85,7 +89,7 @@ module MessagePack
85
89
 
86
90
  def type_registered?(klass_or_type, selector=:both)
87
91
  case klass_or_type
88
- when Class
92
+ when Module
89
93
  klass = klass_or_type
90
94
  registered_types(selector).any?{|entry| klass <= entry[:class] }
91
95
  when Integer
@@ -23,7 +23,7 @@ module MessagePack
23
23
 
24
24
  def type_registered?(klass_or_type)
25
25
  case klass_or_type
26
- when Class
26
+ when Module
27
27
  klass = klass_or_type
28
28
  registered_types.any?{|entry| klass <= entry[:class] }
29
29
  when Integer
@@ -27,7 +27,7 @@ module MessagePack
27
27
 
28
28
  def type_registered?(klass_or_type)
29
29
  case klass_or_type
30
- when Class
30
+ when Module
31
31
  klass = klass_or_type
32
32
  registered_types.any?{|entry| klass == entry[:class] }
33
33
  when Integer
@@ -1,5 +1,5 @@
1
1
  module MessagePack
2
- VERSION = "1.8.3"
2
+ VERSION = "1.8.5"
3
3
  # Note for maintainers:
4
4
  # Don't miss building/releasing the JRuby version (rake buld:java)
5
5
  # See "How to build -java rubygems" in README for more details.
data/msgpack.gemspec CHANGED
@@ -29,13 +29,4 @@ Gem::Specification.new do |s|
29
29
  "documentation_uri" => "https://github.com/msgpack/msgpack/blob/master/spec.md",
30
30
  "source_code_uri" => "https://github.com/msgpack/msgpack-ruby"
31
31
  }
32
-
33
- s.add_development_dependency 'bundler'
34
- s.add_development_dependency 'rake'
35
- s.add_development_dependency 'rake-compiler', ['>= 1.1.9']
36
- s.add_development_dependency 'rspec', ['~> 3.3']
37
- s.add_development_dependency 'ruby_memcheck'
38
- s.add_development_dependency 'yard'
39
- s.add_development_dependency 'json'
40
- s.add_development_dependency 'benchmark-ips', ['~> 2.10.0']
41
32
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: msgpack
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.8.3
4
+ version: 1.8.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sadayuki Furuhashi
@@ -10,119 +10,7 @@ authors:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
  date: 1980-01-02 00:00:00.000000000 Z
13
- dependencies:
14
- - !ruby/object:Gem::Dependency
15
- name: bundler
16
- requirement: !ruby/object:Gem::Requirement
17
- requirements:
18
- - - ">="
19
- - !ruby/object:Gem::Version
20
- version: '0'
21
- type: :development
22
- prerelease: false
23
- version_requirements: !ruby/object:Gem::Requirement
24
- requirements:
25
- - - ">="
26
- - !ruby/object:Gem::Version
27
- version: '0'
28
- - !ruby/object:Gem::Dependency
29
- name: rake
30
- requirement: !ruby/object:Gem::Requirement
31
- requirements:
32
- - - ">="
33
- - !ruby/object:Gem::Version
34
- version: '0'
35
- type: :development
36
- prerelease: false
37
- version_requirements: !ruby/object:Gem::Requirement
38
- requirements:
39
- - - ">="
40
- - !ruby/object:Gem::Version
41
- version: '0'
42
- - !ruby/object:Gem::Dependency
43
- name: rake-compiler
44
- requirement: !ruby/object:Gem::Requirement
45
- requirements:
46
- - - ">="
47
- - !ruby/object:Gem::Version
48
- version: 1.1.9
49
- type: :development
50
- prerelease: false
51
- version_requirements: !ruby/object:Gem::Requirement
52
- requirements:
53
- - - ">="
54
- - !ruby/object:Gem::Version
55
- version: 1.1.9
56
- - !ruby/object:Gem::Dependency
57
- name: rspec
58
- requirement: !ruby/object:Gem::Requirement
59
- requirements:
60
- - - "~>"
61
- - !ruby/object:Gem::Version
62
- version: '3.3'
63
- type: :development
64
- prerelease: false
65
- version_requirements: !ruby/object:Gem::Requirement
66
- requirements:
67
- - - "~>"
68
- - !ruby/object:Gem::Version
69
- version: '3.3'
70
- - !ruby/object:Gem::Dependency
71
- name: ruby_memcheck
72
- requirement: !ruby/object:Gem::Requirement
73
- requirements:
74
- - - ">="
75
- - !ruby/object:Gem::Version
76
- version: '0'
77
- type: :development
78
- prerelease: false
79
- version_requirements: !ruby/object:Gem::Requirement
80
- requirements:
81
- - - ">="
82
- - !ruby/object:Gem::Version
83
- version: '0'
84
- - !ruby/object:Gem::Dependency
85
- name: yard
86
- requirement: !ruby/object:Gem::Requirement
87
- requirements:
88
- - - ">="
89
- - !ruby/object:Gem::Version
90
- version: '0'
91
- type: :development
92
- prerelease: false
93
- version_requirements: !ruby/object:Gem::Requirement
94
- requirements:
95
- - - ">="
96
- - !ruby/object:Gem::Version
97
- version: '0'
98
- - !ruby/object:Gem::Dependency
99
- name: json
100
- requirement: !ruby/object:Gem::Requirement
101
- requirements:
102
- - - ">="
103
- - !ruby/object:Gem::Version
104
- version: '0'
105
- type: :development
106
- prerelease: false
107
- version_requirements: !ruby/object:Gem::Requirement
108
- requirements:
109
- - - ">="
110
- - !ruby/object:Gem::Version
111
- version: '0'
112
- - !ruby/object:Gem::Dependency
113
- name: benchmark-ips
114
- requirement: !ruby/object:Gem::Requirement
115
- requirements:
116
- - - "~>"
117
- - !ruby/object:Gem::Version
118
- version: 2.10.0
119
- type: :development
120
- prerelease: false
121
- version_requirements: !ruby/object:Gem::Requirement
122
- requirements:
123
- - - "~>"
124
- - !ruby/object:Gem::Version
125
- version: 2.10.0
13
+ dependencies: []
126
14
  description: MessagePack is a binary-based efficient object serialization library.
127
15
  It enables to exchange structured objects between many languages like JSON. But
128
16
  unlike JSON, it is very fast and small.
@@ -210,7 +98,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
210
98
  - !ruby/object:Gem::Version
211
99
  version: '0'
212
100
  requirements: []
213
- rubygems_version: 4.0.12
101
+ rubygems_version: 4.0.16
214
102
  specification_version: 4
215
103
  summary: MessagePack, a binary-based efficient data interchange format.
216
104
  test_files: []