msgpack 1.8.4 → 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 +4 -4
- data/ChangeLog +7 -0
- data/ext/java/org/msgpack/jruby/Factory.java +5 -2
- data/ext/msgpack/factory_class.c +10 -7
- data/ext/msgpack/packer_class.c +1 -1
- data/ext/msgpack/unpacker.c +8 -2
- data/lib/msgpack/factory.rb +12 -8
- data/lib/msgpack/packer.rb +1 -1
- data/lib/msgpack/unpacker.rb +1 -1
- data/lib/msgpack/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 9a5462dff41bc8885570f42b59092d6e02729500a9a873aa15ead68ed8872ccb
|
|
4
|
+
data.tar.gz: 3fcc99b85b8ece0dd0158f2ee511784a789f41ab9d3bafd9f6fc006ccd3b9061
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 3cb8969960d3d2de3beb39503cb33259ac169f27397d75f981a2563bf14700e4359ca30f2fc6357bf848b707546dc0c692385250c186496e2ef7d5546809bab3
|
|
7
|
+
data.tar.gz: 5cb7b9154e12839ee504c5630d3cee504558206ea63fb54236fc7433191a763267a7fce29a43157d59507f0cc1d4b5b88ba62607571ce98ca1175aa911c1c338
|
data/ChangeLog
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
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
|
+
|
|
1
8
|
2026-07-28 1.8.4
|
|
2
9
|
|
|
3
10
|
* Fix `MessagePack::Buffer` to stop using already released memory page.
|
|
@@ -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()
|
|
114
|
-
hasSymbolExtType =
|
|
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/factory_class.c
CHANGED
|
@@ -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
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
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_class.c
CHANGED
|
@@ -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 %
|
|
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);
|
data/ext/msgpack/unpacker.c
CHANGED
|
@@ -386,9 +386,15 @@ static inline int read_raw_body_begin(msgpack_unpacker_t* uk, int raw_type)
|
|
|
386
386
|
* instead of raising StackError like every other container type. */
|
|
387
387
|
return PRIMITIVE_STACK_TOO_DEEP;
|
|
388
388
|
}
|
|
389
|
+
size_t barrier_depth = uk->stack.depth;
|
|
389
390
|
int raised;
|
|
390
391
|
obj = protected_proc_call(proc, 1, &uk->self, &raised);
|
|
391
|
-
|
|
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;
|
|
392
398
|
|
|
393
399
|
if (raised) {
|
|
394
400
|
uk->last_object = rb_errinfo();
|
|
@@ -911,8 +917,8 @@ int msgpack_unpacker_skip_nil(msgpack_unpacker_t* uk)
|
|
|
911
917
|
return b;
|
|
912
918
|
}
|
|
913
919
|
if(b == 0xc0) {
|
|
920
|
+
reset_head_byte(uk);
|
|
914
921
|
return 1;
|
|
915
922
|
}
|
|
916
923
|
return 0;
|
|
917
924
|
}
|
|
918
|
-
|
data/lib/msgpack/factory.rb
CHANGED
|
@@ -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
|
-
|
|
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
|
-
|
|
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
|
|
92
|
+
when Module
|
|
89
93
|
klass = klass_or_type
|
|
90
94
|
registered_types(selector).any?{|entry| klass <= entry[:class] }
|
|
91
95
|
when Integer
|
data/lib/msgpack/packer.rb
CHANGED
data/lib/msgpack/unpacker.rb
CHANGED
data/lib/msgpack/version.rb
CHANGED