msgpack 1.8.0 → 1.8.3
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 +15 -0
- data/README.md +1 -1
- data/ext/java/org/msgpack/jruby/Decoder.java +15 -7
- data/ext/msgpack/buffer.c +3 -0
- data/ext/msgpack/unpacker.c +16 -14
- data/lib/msgpack/version.rb +1 -1
- data/msgpack.gemspec +9 -4
- metadata +8 -5
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ed5705d96741dbe59f61d59de79d133dfead8636cbf8c9db51b684c425a52e34
|
|
4
|
+
data.tar.gz: 6fa2a89acb1a2ae0db5068fa59b483d2292e0b9ad681f9c3c058cf164dd28385
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 8edfe983aaee5230a1c1547e45894403c9c4435a65bbe4d88b4e9a800bb31467ad867526f4d54baf2cd6b7738cd9458104fc0caa772bba0dcbcb25c427002218
|
|
7
|
+
data.tar.gz: 3d282debd040b4f9b0f2a15c2c34068b64d01c696d1756f235c63078e54d5fcc2d1896f1b32321aa2c70ec67b8205eb608e841aff60eecd78a651e614016eac3
|
data/ChangeLog
CHANGED
|
@@ -1,3 +1,18 @@
|
|
|
1
|
+
2026-06-10 1.8.3
|
|
2
|
+
|
|
3
|
+
* Fix an integer overflow when parsing maps.
|
|
4
|
+
|
|
5
|
+
2026-06-09 1.8.2
|
|
6
|
+
|
|
7
|
+
* Fix `Buffer#clear` to properly reset memory chunks before adding them back to the pool.
|
|
8
|
+
This could have caused data to leak across buffers when using the MessagePack::Buffer API
|
|
9
|
+
directly. [CVE-PENDING].
|
|
10
|
+
|
|
11
|
+
2026-05-28 1.8.1
|
|
12
|
+
|
|
13
|
+
* Workaround rare compilation issue when `rb_hash_new_capa` isn't properly detected.
|
|
14
|
+
* Never pre-allocate strings larger than the buffered size.
|
|
15
|
+
|
|
1
16
|
2025-02-06 1.8.0
|
|
2
17
|
|
|
3
18
|
* Numerous small optimizations.
|
data/README.md
CHANGED
|
@@ -85,6 +85,14 @@ public class Decoder implements Iterator<IRubyObject> {
|
|
|
85
85
|
feed(bytes, offset, length);
|
|
86
86
|
}
|
|
87
87
|
|
|
88
|
+
private int getUnsignedInt() {
|
|
89
|
+
int size = buffer.getInt();
|
|
90
|
+
if (size < 0) {
|
|
91
|
+
throw runtime.newRaiseException(underflowErrorClass, "Size too large (limited to 2**31 for the Java version)");
|
|
92
|
+
}
|
|
93
|
+
return size;
|
|
94
|
+
}
|
|
95
|
+
|
|
88
96
|
public void feed(byte[] bytes) {
|
|
89
97
|
feed(bytes, 0, bytes.length);
|
|
90
98
|
}
|
|
@@ -200,7 +208,7 @@ public class Decoder implements Iterator<IRubyObject> {
|
|
|
200
208
|
} else if (b == ARY16) {
|
|
201
209
|
return runtime.newFixnum(buffer.getShort() & 0xffff);
|
|
202
210
|
} else if (b == ARY32) {
|
|
203
|
-
return runtime.newFixnum(
|
|
211
|
+
return runtime.newFixnum(getUnsignedInt());
|
|
204
212
|
}
|
|
205
213
|
throw runtime.newRaiseException(unexpectedTypeErrorClass, "unexpected type");
|
|
206
214
|
} catch (RaiseException re) {
|
|
@@ -221,7 +229,7 @@ public class Decoder implements Iterator<IRubyObject> {
|
|
|
221
229
|
} else if (b == MAP16) {
|
|
222
230
|
return runtime.newFixnum(buffer.getShort() & 0xffff);
|
|
223
231
|
} else if (b == MAP32) {
|
|
224
|
-
return runtime.newFixnum(
|
|
232
|
+
return runtime.newFixnum(getUnsignedInt());
|
|
225
233
|
}
|
|
226
234
|
throw runtime.newRaiseException(unexpectedTypeErrorClass, "unexpected type");
|
|
227
235
|
} catch (RaiseException re) {
|
|
@@ -258,10 +266,10 @@ public class Decoder implements Iterator<IRubyObject> {
|
|
|
258
266
|
case TRUE: return runtime.getTrue();
|
|
259
267
|
case BIN8: return consumeString(buffer.get() & 0xff, binaryEncoding);
|
|
260
268
|
case BIN16: return consumeString(buffer.getShort() & 0xffff, binaryEncoding);
|
|
261
|
-
case BIN32: return consumeString(
|
|
269
|
+
case BIN32: return consumeString(getUnsignedInt(), binaryEncoding);
|
|
262
270
|
case VAREXT8: return consumeExtension(buffer.get() & 0xff);
|
|
263
271
|
case VAREXT16: return consumeExtension(buffer.getShort() & 0xffff);
|
|
264
|
-
case VAREXT32: return consumeExtension(
|
|
272
|
+
case VAREXT32: return consumeExtension(getUnsignedInt());
|
|
265
273
|
case FLOAT32: return runtime.newFloat(buffer.getFloat());
|
|
266
274
|
case FLOAT64: return runtime.newFloat(buffer.getDouble());
|
|
267
275
|
case UINT8: return runtime.newFixnum(buffer.get() & 0xffL);
|
|
@@ -283,11 +291,11 @@ public class Decoder implements Iterator<IRubyObject> {
|
|
|
283
291
|
case FIXEXT16: return consumeExtension(16);
|
|
284
292
|
case STR8: return consumeString(buffer.get() & 0xff, utf8Encoding);
|
|
285
293
|
case STR16: return consumeString(buffer.getShort() & 0xffff, utf8Encoding);
|
|
286
|
-
case STR32: return consumeString(
|
|
294
|
+
case STR32: return consumeString(getUnsignedInt(), utf8Encoding);
|
|
287
295
|
case ARY16: return consumeArray(buffer.getShort() & 0xffff);
|
|
288
|
-
case ARY32: return consumeArray(
|
|
296
|
+
case ARY32: return consumeArray(getUnsignedInt());
|
|
289
297
|
case MAP16: return consumeHash(buffer.getShort() & 0xffff);
|
|
290
|
-
case MAP32: return consumeHash(
|
|
298
|
+
case MAP32: return consumeHash(getUnsignedInt());
|
|
291
299
|
default: break outer;
|
|
292
300
|
}
|
|
293
301
|
case 0xe:
|
data/ext/msgpack/buffer.c
CHANGED
|
@@ -134,6 +134,9 @@ bool _msgpack_buffer_shift_chunk(msgpack_buffer_t* b)
|
|
|
134
134
|
* because head should be always available */
|
|
135
135
|
b->tail_buffer_end = NULL;
|
|
136
136
|
b->read_buffer = NULL;
|
|
137
|
+
b->rmem_end = NULL;
|
|
138
|
+
b->rmem_last = NULL;
|
|
139
|
+
b->rmem_owner = NULL;
|
|
137
140
|
return false;
|
|
138
141
|
}
|
|
139
142
|
|
data/ext/msgpack/unpacker.c
CHANGED
|
@@ -67,10 +67,11 @@ static int16_t INITIAL_BUFFER_CAPACITY_MAX = SHRT_MAX;
|
|
|
67
67
|
static msgpack_rmem_t s_stack_rmem;
|
|
68
68
|
|
|
69
69
|
#if !defined(HAVE_RB_HASH_NEW_CAPA)
|
|
70
|
-
static inline VALUE
|
|
70
|
+
static inline VALUE rb_hash_new_capa_inline(long capa)
|
|
71
71
|
{
|
|
72
72
|
return rb_hash_new();
|
|
73
73
|
}
|
|
74
|
+
#define rb_hash_new_capa rb_hash_new_capa_inline
|
|
74
75
|
#endif
|
|
75
76
|
|
|
76
77
|
static inline int16_t initial_buffer_size(long size)
|
|
@@ -335,7 +336,8 @@ static int read_raw_body_cont(msgpack_unpacker_t* uk)
|
|
|
335
336
|
size_t length = uk->reading_raw_remaining;
|
|
336
337
|
|
|
337
338
|
if(uk->reading_raw == Qnil) {
|
|
338
|
-
|
|
339
|
+
size_t buffered_size = msgpack_buffer_all_readable_size(UNPACKER_BUFFER_(uk));
|
|
340
|
+
uk->reading_raw = rb_str_buf_new(length > buffered_size ? buffered_size : length);
|
|
339
341
|
}
|
|
340
342
|
|
|
341
343
|
do {
|
|
@@ -454,13 +456,13 @@ static int read_primitive(msgpack_unpacker_t* uk)
|
|
|
454
456
|
return object_complete(uk, INT2NUM((int8_t)b));
|
|
455
457
|
|
|
456
458
|
SWITCH_RANGE(b, 0xa0, 0xbf) // FixRaw / fixstr
|
|
457
|
-
|
|
459
|
+
size_t count = b & 0x1f;
|
|
458
460
|
/* read_raw_body_begin sets uk->reading_raw */
|
|
459
461
|
uk->reading_raw_remaining = count;
|
|
460
462
|
return read_raw_body_begin(uk, RAW_TYPE_STRING);
|
|
461
463
|
|
|
462
464
|
SWITCH_RANGE(b, 0x90, 0x9f) // FixArray
|
|
463
|
-
|
|
465
|
+
size_t count = b & 0x0f;
|
|
464
466
|
if(count == 0) {
|
|
465
467
|
return object_complete(uk, rb_ary_new());
|
|
466
468
|
}
|
|
@@ -636,7 +638,7 @@ static int read_primitive(msgpack_unpacker_t* uk)
|
|
|
636
638
|
case 0xd9: // raw 8 / str 8
|
|
637
639
|
{
|
|
638
640
|
READ_CAST_BLOCK_OR_RETURN_EOF(cb, uk, 1);
|
|
639
|
-
|
|
641
|
+
size_t count = cb.u8;
|
|
640
642
|
/* read_raw_body_begin sets uk->reading_raw */
|
|
641
643
|
uk->reading_raw_remaining = count;
|
|
642
644
|
return read_raw_body_begin(uk, RAW_TYPE_STRING);
|
|
@@ -645,7 +647,7 @@ static int read_primitive(msgpack_unpacker_t* uk)
|
|
|
645
647
|
case 0xda: // raw 16 / str 16
|
|
646
648
|
{
|
|
647
649
|
READ_CAST_BLOCK_OR_RETURN_EOF(cb, uk, 2);
|
|
648
|
-
|
|
650
|
+
size_t count = _msgpack_be16(cb.u16);
|
|
649
651
|
/* read_raw_body_begin sets uk->reading_raw */
|
|
650
652
|
uk->reading_raw_remaining = count;
|
|
651
653
|
return read_raw_body_begin(uk, RAW_TYPE_STRING);
|
|
@@ -654,7 +656,7 @@ static int read_primitive(msgpack_unpacker_t* uk)
|
|
|
654
656
|
case 0xdb: // raw 32 / str 32
|
|
655
657
|
{
|
|
656
658
|
READ_CAST_BLOCK_OR_RETURN_EOF(cb, uk, 4);
|
|
657
|
-
|
|
659
|
+
size_t count = _msgpack_be32(cb.u32);
|
|
658
660
|
/* read_raw_body_begin sets uk->reading_raw */
|
|
659
661
|
uk->reading_raw_remaining = count;
|
|
660
662
|
return read_raw_body_begin(uk, RAW_TYPE_STRING);
|
|
@@ -663,7 +665,7 @@ static int read_primitive(msgpack_unpacker_t* uk)
|
|
|
663
665
|
case 0xc4: // bin 8
|
|
664
666
|
{
|
|
665
667
|
READ_CAST_BLOCK_OR_RETURN_EOF(cb, uk, 1);
|
|
666
|
-
|
|
668
|
+
size_t count = cb.u8;
|
|
667
669
|
/* read_raw_body_begin sets uk->reading_raw */
|
|
668
670
|
uk->reading_raw_remaining = count;
|
|
669
671
|
return read_raw_body_begin(uk, RAW_TYPE_BINARY);
|
|
@@ -672,7 +674,7 @@ static int read_primitive(msgpack_unpacker_t* uk)
|
|
|
672
674
|
case 0xc5: // bin 16
|
|
673
675
|
{
|
|
674
676
|
READ_CAST_BLOCK_OR_RETURN_EOF(cb, uk, 2);
|
|
675
|
-
|
|
677
|
+
size_t count = _msgpack_be16(cb.u16);
|
|
676
678
|
/* read_raw_body_begin sets uk->reading_raw */
|
|
677
679
|
uk->reading_raw_remaining = count;
|
|
678
680
|
return read_raw_body_begin(uk, RAW_TYPE_BINARY);
|
|
@@ -681,7 +683,7 @@ static int read_primitive(msgpack_unpacker_t* uk)
|
|
|
681
683
|
case 0xc6: // bin 32
|
|
682
684
|
{
|
|
683
685
|
READ_CAST_BLOCK_OR_RETURN_EOF(cb, uk, 4);
|
|
684
|
-
|
|
686
|
+
size_t count = _msgpack_be32(cb.u32);
|
|
685
687
|
/* read_raw_body_begin sets uk->reading_raw */
|
|
686
688
|
uk->reading_raw_remaining = count;
|
|
687
689
|
return read_raw_body_begin(uk, RAW_TYPE_BINARY);
|
|
@@ -690,7 +692,7 @@ static int read_primitive(msgpack_unpacker_t* uk)
|
|
|
690
692
|
case 0xdc: // array 16
|
|
691
693
|
{
|
|
692
694
|
READ_CAST_BLOCK_OR_RETURN_EOF(cb, uk, 2);
|
|
693
|
-
|
|
695
|
+
size_t count = _msgpack_be16(cb.u16);
|
|
694
696
|
if(count == 0) {
|
|
695
697
|
return object_complete(uk, rb_ary_new());
|
|
696
698
|
}
|
|
@@ -700,7 +702,7 @@ static int read_primitive(msgpack_unpacker_t* uk)
|
|
|
700
702
|
case 0xdd: // array 32
|
|
701
703
|
{
|
|
702
704
|
READ_CAST_BLOCK_OR_RETURN_EOF(cb, uk, 4);
|
|
703
|
-
|
|
705
|
+
size_t count = _msgpack_be32(cb.u32);
|
|
704
706
|
if(count == 0) {
|
|
705
707
|
return object_complete(uk, rb_ary_new());
|
|
706
708
|
}
|
|
@@ -710,7 +712,7 @@ static int read_primitive(msgpack_unpacker_t* uk)
|
|
|
710
712
|
case 0xde: // map 16
|
|
711
713
|
{
|
|
712
714
|
READ_CAST_BLOCK_OR_RETURN_EOF(cb, uk, 2);
|
|
713
|
-
|
|
715
|
+
size_t count = _msgpack_be16(cb.u16);
|
|
714
716
|
if(count == 0) {
|
|
715
717
|
return object_complete(uk, rb_hash_new());
|
|
716
718
|
}
|
|
@@ -720,7 +722,7 @@ static int read_primitive(msgpack_unpacker_t* uk)
|
|
|
720
722
|
case 0xdf: // map 32
|
|
721
723
|
{
|
|
722
724
|
READ_CAST_BLOCK_OR_RETURN_EOF(cb, uk, 4);
|
|
723
|
-
|
|
725
|
+
size_t count = _msgpack_be32(cb.u32);
|
|
724
726
|
if(count == 0) {
|
|
725
727
|
return object_complete(uk, rb_hash_new());
|
|
726
728
|
}
|
data/lib/msgpack/version.rb
CHANGED
data/msgpack.gemspec
CHANGED
|
@@ -8,8 +8,8 @@ Gem::Specification.new do |s|
|
|
|
8
8
|
s.description = %q{MessagePack is a binary-based efficient object serialization library. It enables to exchange structured objects between many languages like JSON. But unlike JSON, it is very fast and small.}
|
|
9
9
|
s.authors = ["Sadayuki Furuhashi", "Theo Hultberg", "Satoshi Tagomori"]
|
|
10
10
|
s.email = ["frsyuki@gmail.com", "theo@iconara.net", "tagomoris@gmail.com"]
|
|
11
|
-
s.license = "Apache
|
|
12
|
-
s.homepage = "
|
|
11
|
+
s.license = "Apache-2.0"
|
|
12
|
+
s.homepage = "https://msgpack.org/"
|
|
13
13
|
s.require_paths = ["lib"]
|
|
14
14
|
if /java/ =~ RUBY_PLATFORM
|
|
15
15
|
s.files = Dir['lib/**/*.rb', 'lib/**/*.jar', 'LICENSE']
|
|
@@ -23,6 +23,13 @@ Gem::Specification.new do |s|
|
|
|
23
23
|
|
|
24
24
|
s.required_ruby_version = ">= 2.5"
|
|
25
25
|
|
|
26
|
+
s.metadata = {
|
|
27
|
+
"bug_tracker_uri" => "https://github.com/msgpack/msgpack-ruby/issues",
|
|
28
|
+
"changelog_uri" => "https://github.com/msgpack/msgpack-ruby/blob/master/ChangeLog",
|
|
29
|
+
"documentation_uri" => "https://github.com/msgpack/msgpack/blob/master/spec.md",
|
|
30
|
+
"source_code_uri" => "https://github.com/msgpack/msgpack-ruby"
|
|
31
|
+
}
|
|
32
|
+
|
|
26
33
|
s.add_development_dependency 'bundler'
|
|
27
34
|
s.add_development_dependency 'rake'
|
|
28
35
|
s.add_development_dependency 'rake-compiler', ['>= 1.1.9']
|
|
@@ -31,6 +38,4 @@ Gem::Specification.new do |s|
|
|
|
31
38
|
s.add_development_dependency 'yard'
|
|
32
39
|
s.add_development_dependency 'json'
|
|
33
40
|
s.add_development_dependency 'benchmark-ips', ['~> 2.10.0']
|
|
34
|
-
|
|
35
|
-
s.metadata["changelog_uri"] = "https://github.com/msgpack/msgpack-ruby/blob/master/ChangeLog"
|
|
36
41
|
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.
|
|
4
|
+
version: 1.8.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Sadayuki Furuhashi
|
|
@@ -9,7 +9,7 @@ authors:
|
|
|
9
9
|
- Satoshi Tagomori
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date:
|
|
12
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: bundler
|
|
@@ -188,11 +188,14 @@ files:
|
|
|
188
188
|
- lib/msgpack/unpacker.rb
|
|
189
189
|
- lib/msgpack/version.rb
|
|
190
190
|
- msgpack.gemspec
|
|
191
|
-
homepage:
|
|
191
|
+
homepage: https://msgpack.org/
|
|
192
192
|
licenses:
|
|
193
|
-
- Apache
|
|
193
|
+
- Apache-2.0
|
|
194
194
|
metadata:
|
|
195
|
+
bug_tracker_uri: https://github.com/msgpack/msgpack-ruby/issues
|
|
195
196
|
changelog_uri: https://github.com/msgpack/msgpack-ruby/blob/master/ChangeLog
|
|
197
|
+
documentation_uri: https://github.com/msgpack/msgpack/blob/master/spec.md
|
|
198
|
+
source_code_uri: https://github.com/msgpack/msgpack-ruby
|
|
196
199
|
rdoc_options: []
|
|
197
200
|
require_paths:
|
|
198
201
|
- lib
|
|
@@ -207,7 +210,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
207
210
|
- !ruby/object:Gem::Version
|
|
208
211
|
version: '0'
|
|
209
212
|
requirements: []
|
|
210
|
-
rubygems_version:
|
|
213
|
+
rubygems_version: 4.0.12
|
|
211
214
|
specification_version: 4
|
|
212
215
|
summary: MessagePack, a binary-based efficient data interchange format.
|
|
213
216
|
test_files: []
|