msgpack 1.8.2 → 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 +4 -0
- data/ext/java/org/msgpack/jruby/Decoder.java +15 -7
- data/ext/msgpack/unpacker.c +12 -12
- 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: 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
|
@@ -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/unpacker.c
CHANGED
|
@@ -456,13 +456,13 @@ static int read_primitive(msgpack_unpacker_t* uk)
|
|
|
456
456
|
return object_complete(uk, INT2NUM((int8_t)b));
|
|
457
457
|
|
|
458
458
|
SWITCH_RANGE(b, 0xa0, 0xbf) // FixRaw / fixstr
|
|
459
|
-
|
|
459
|
+
size_t count = b & 0x1f;
|
|
460
460
|
/* read_raw_body_begin sets uk->reading_raw */
|
|
461
461
|
uk->reading_raw_remaining = count;
|
|
462
462
|
return read_raw_body_begin(uk, RAW_TYPE_STRING);
|
|
463
463
|
|
|
464
464
|
SWITCH_RANGE(b, 0x90, 0x9f) // FixArray
|
|
465
|
-
|
|
465
|
+
size_t count = b & 0x0f;
|
|
466
466
|
if(count == 0) {
|
|
467
467
|
return object_complete(uk, rb_ary_new());
|
|
468
468
|
}
|
|
@@ -638,7 +638,7 @@ static int read_primitive(msgpack_unpacker_t* uk)
|
|
|
638
638
|
case 0xd9: // raw 8 / str 8
|
|
639
639
|
{
|
|
640
640
|
READ_CAST_BLOCK_OR_RETURN_EOF(cb, uk, 1);
|
|
641
|
-
|
|
641
|
+
size_t count = cb.u8;
|
|
642
642
|
/* read_raw_body_begin sets uk->reading_raw */
|
|
643
643
|
uk->reading_raw_remaining = count;
|
|
644
644
|
return read_raw_body_begin(uk, RAW_TYPE_STRING);
|
|
@@ -647,7 +647,7 @@ static int read_primitive(msgpack_unpacker_t* uk)
|
|
|
647
647
|
case 0xda: // raw 16 / str 16
|
|
648
648
|
{
|
|
649
649
|
READ_CAST_BLOCK_OR_RETURN_EOF(cb, uk, 2);
|
|
650
|
-
|
|
650
|
+
size_t count = _msgpack_be16(cb.u16);
|
|
651
651
|
/* read_raw_body_begin sets uk->reading_raw */
|
|
652
652
|
uk->reading_raw_remaining = count;
|
|
653
653
|
return read_raw_body_begin(uk, RAW_TYPE_STRING);
|
|
@@ -656,7 +656,7 @@ static int read_primitive(msgpack_unpacker_t* uk)
|
|
|
656
656
|
case 0xdb: // raw 32 / str 32
|
|
657
657
|
{
|
|
658
658
|
READ_CAST_BLOCK_OR_RETURN_EOF(cb, uk, 4);
|
|
659
|
-
|
|
659
|
+
size_t count = _msgpack_be32(cb.u32);
|
|
660
660
|
/* read_raw_body_begin sets uk->reading_raw */
|
|
661
661
|
uk->reading_raw_remaining = count;
|
|
662
662
|
return read_raw_body_begin(uk, RAW_TYPE_STRING);
|
|
@@ -665,7 +665,7 @@ static int read_primitive(msgpack_unpacker_t* uk)
|
|
|
665
665
|
case 0xc4: // bin 8
|
|
666
666
|
{
|
|
667
667
|
READ_CAST_BLOCK_OR_RETURN_EOF(cb, uk, 1);
|
|
668
|
-
|
|
668
|
+
size_t count = cb.u8;
|
|
669
669
|
/* read_raw_body_begin sets uk->reading_raw */
|
|
670
670
|
uk->reading_raw_remaining = count;
|
|
671
671
|
return read_raw_body_begin(uk, RAW_TYPE_BINARY);
|
|
@@ -674,7 +674,7 @@ static int read_primitive(msgpack_unpacker_t* uk)
|
|
|
674
674
|
case 0xc5: // bin 16
|
|
675
675
|
{
|
|
676
676
|
READ_CAST_BLOCK_OR_RETURN_EOF(cb, uk, 2);
|
|
677
|
-
|
|
677
|
+
size_t count = _msgpack_be16(cb.u16);
|
|
678
678
|
/* read_raw_body_begin sets uk->reading_raw */
|
|
679
679
|
uk->reading_raw_remaining = count;
|
|
680
680
|
return read_raw_body_begin(uk, RAW_TYPE_BINARY);
|
|
@@ -683,7 +683,7 @@ static int read_primitive(msgpack_unpacker_t* uk)
|
|
|
683
683
|
case 0xc6: // bin 32
|
|
684
684
|
{
|
|
685
685
|
READ_CAST_BLOCK_OR_RETURN_EOF(cb, uk, 4);
|
|
686
|
-
|
|
686
|
+
size_t count = _msgpack_be32(cb.u32);
|
|
687
687
|
/* read_raw_body_begin sets uk->reading_raw */
|
|
688
688
|
uk->reading_raw_remaining = count;
|
|
689
689
|
return read_raw_body_begin(uk, RAW_TYPE_BINARY);
|
|
@@ -692,7 +692,7 @@ static int read_primitive(msgpack_unpacker_t* uk)
|
|
|
692
692
|
case 0xdc: // array 16
|
|
693
693
|
{
|
|
694
694
|
READ_CAST_BLOCK_OR_RETURN_EOF(cb, uk, 2);
|
|
695
|
-
|
|
695
|
+
size_t count = _msgpack_be16(cb.u16);
|
|
696
696
|
if(count == 0) {
|
|
697
697
|
return object_complete(uk, rb_ary_new());
|
|
698
698
|
}
|
|
@@ -702,7 +702,7 @@ static int read_primitive(msgpack_unpacker_t* uk)
|
|
|
702
702
|
case 0xdd: // array 32
|
|
703
703
|
{
|
|
704
704
|
READ_CAST_BLOCK_OR_RETURN_EOF(cb, uk, 4);
|
|
705
|
-
|
|
705
|
+
size_t count = _msgpack_be32(cb.u32);
|
|
706
706
|
if(count == 0) {
|
|
707
707
|
return object_complete(uk, rb_ary_new());
|
|
708
708
|
}
|
|
@@ -712,7 +712,7 @@ static int read_primitive(msgpack_unpacker_t* uk)
|
|
|
712
712
|
case 0xde: // map 16
|
|
713
713
|
{
|
|
714
714
|
READ_CAST_BLOCK_OR_RETURN_EOF(cb, uk, 2);
|
|
715
|
-
|
|
715
|
+
size_t count = _msgpack_be16(cb.u16);
|
|
716
716
|
if(count == 0) {
|
|
717
717
|
return object_complete(uk, rb_hash_new());
|
|
718
718
|
}
|
|
@@ -722,7 +722,7 @@ static int read_primitive(msgpack_unpacker_t* uk)
|
|
|
722
722
|
case 0xdf: // map 32
|
|
723
723
|
{
|
|
724
724
|
READ_CAST_BLOCK_OR_RETURN_EOF(cb, uk, 4);
|
|
725
|
-
|
|
725
|
+
size_t count = _msgpack_be32(cb.u32);
|
|
726
726
|
if(count == 0) {
|
|
727
727
|
return object_complete(uk, rb_hash_new());
|
|
728
728
|
}
|
data/lib/msgpack/version.rb
CHANGED