cbor 0.5.10.1 → 0.5.10.2
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/ext/cbor/buffer_class.c +0 -2
- data/ext/cbor/unpacker.c +1 -0
- data/lib/cbor/version.rb +1 -1
- data/spec/format_spec.rb +60 -0
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: fafbded4dd72295218759d12eea5b09b280ec06719eca7d646164173a2405fe2
|
|
4
|
+
data.tar.gz: abcc97eaa52ad9abd549b3bf18819ff2982f09d1ab283df06ff46d7f10a4c470
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 82e84122c5a22dc4a6644823d92a33de60a55f58ef0844637aad0e72a6fdf899afa1f016aafc1306e12ec323c55c035ef5a9148252c68f162fd75d222f61262f
|
|
7
|
+
data.tar.gz: a68bc717c4886e2dc5dd969941f2f33d620bcdbe8d9609ab06356ecc7d2de7e26699c21f8b56eb51d3b942204772e84413778aa7fb7fdcfb9a933c7a1923362a
|
data/ext/cbor/buffer_class.c
CHANGED
data/ext/cbor/unpacker.c
CHANGED
|
@@ -683,6 +683,7 @@ int msgpack_unpacker_read(msgpack_unpacker_t* uk, size_t target_stack_depth)
|
|
|
683
683
|
if(msgpack_unpacker_stack_pop(uk) <= target_stack_depth) {
|
|
684
684
|
return PRIMITIVE_OBJECT_COMPLETE;
|
|
685
685
|
}
|
|
686
|
+
r = PRIMITIVE_OBJECT_COMPLETE;
|
|
686
687
|
goto container_completed;
|
|
687
688
|
}
|
|
688
689
|
}
|
data/lib/cbor/version.rb
CHANGED
data/spec/format_spec.rb
CHANGED
|
@@ -334,6 +334,66 @@ describe MessagePack do
|
|
|
334
334
|
}.should raise_error(MessagePack::MalformedFormatError)
|
|
335
335
|
end
|
|
336
336
|
|
|
337
|
+
# Regression tests for https://github.com/cabo/cbor-ruby/issues/20
|
|
338
|
+
# Nested indefinite-length containers should decode correctly.
|
|
339
|
+
|
|
340
|
+
it "{_ 'a' => [_ 1]}" do
|
|
341
|
+
# indefinite map containing an indefinite array
|
|
342
|
+
check_decode "\xbf\x61a\x9f\x01\xff\xff", {"a" => [1]}
|
|
343
|
+
end
|
|
344
|
+
|
|
345
|
+
it "{_ 'a' => [_ 1], 'b' => [2, 3]}" do
|
|
346
|
+
# indefinite map containing an indefinite and a definite array
|
|
347
|
+
check_decode "\xbf\x61a\x9f\x01\xff\x61b\x82\x02\x03\xff", {"a" => [1], "b" => [2, 3]}
|
|
348
|
+
end
|
|
349
|
+
|
|
350
|
+
it "{_ 'a' => {_ 'b' => 1}}" do
|
|
351
|
+
# indefinite map containing an indefinite map
|
|
352
|
+
check_decode "\xbf\x61a\xbf\x61b\x01\xff\xff", {"a" => {"b" => 1}}
|
|
353
|
+
end
|
|
354
|
+
|
|
355
|
+
it "{_ 'a' => {_ }}" do
|
|
356
|
+
# indefinite map containing an empty indefinite map
|
|
357
|
+
check_decode "\xbf\x61a\xbf\xff\xff", {"a" => {}}
|
|
358
|
+
end
|
|
359
|
+
|
|
360
|
+
it "{_ 'a' => {_ NO BREAK}" do
|
|
361
|
+
# indefinite map containing an empty indefinite map
|
|
362
|
+
lambda {
|
|
363
|
+
check_decode "\xbf\x61a\xbf\xff", {"a" => {}}
|
|
364
|
+
}.should raise_error(EOFError)
|
|
365
|
+
end
|
|
366
|
+
|
|
367
|
+
it "{_ 'a' => {} NO BREAK" do
|
|
368
|
+
# indefinite map containing an empty indefinite map
|
|
369
|
+
lambda {
|
|
370
|
+
check_decode "\xbf\x61a\xa0", {"a" => {}}
|
|
371
|
+
}.should raise_error(EOFError)
|
|
372
|
+
end
|
|
373
|
+
|
|
374
|
+
it "{_ 'a' => {_ 'b' => 1}, 'b' => {'c' => 2}}" do
|
|
375
|
+
# indefinite map containing an indefinite and a definite map
|
|
376
|
+
check_decode "\xbf\x61a\xbf\x61b\x01\xff\x61b\xa1\x61c\x02\xff", {"a" => {"b" => 1}, "b" => {"c" => 2}}
|
|
377
|
+
end
|
|
378
|
+
|
|
379
|
+
it "[_ {_ 'a' => 1}]" do
|
|
380
|
+
# indefinite array containing an indefinite map
|
|
381
|
+
check_decode "\x9f\xbf\x61a\x01\xff\xff", [{"a" => 1}]
|
|
382
|
+
end
|
|
383
|
+
|
|
384
|
+
it "{_ 'files' => [{_ 'name' => 'foo'}]}" do
|
|
385
|
+
# indefinite map containing a definite array of indefinite maps
|
|
386
|
+
# (the exact pattern produced by Jackson's CBOR serializer)
|
|
387
|
+
check_decode "\xbf\x65files\x81\xbf\x64name\x63foo\xff\xff",
|
|
388
|
+
{"files" => [{"name" => "foo"}]}
|
|
389
|
+
end
|
|
390
|
+
|
|
391
|
+
it "deeply nested indefinite containers" do
|
|
392
|
+
# {_ "a" => {_ "b" => [_ {_ "c" => 1}]}}
|
|
393
|
+
check_decode "\xbf\x61a\xbf\x61b\x9f\xbf\x61c\x01\xff\xff\xff\xff",
|
|
394
|
+
{"a" => {"b" => [{"c" => 1}]}}
|
|
395
|
+
end
|
|
396
|
+
|
|
337
397
|
it "(_ a b)" do
|
|
338
398
|
check_decode "\x7f\xff", "".encode_as_utf8
|
|
339
399
|
check_decode "\x5f\xff", "".b
|
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: cbor
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.5.10.
|
|
4
|
+
version: 0.5.10.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Carsten Bormann, standing on the tall shoulders of Sadayuki Furuhashi
|
|
8
8
|
bindir: bin
|
|
9
9
|
cert_chain: []
|
|
10
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
11
11
|
dependencies:
|
|
12
12
|
- !ruby/object:Gem::Dependency
|
|
13
13
|
name: bundler
|
|
@@ -173,7 +173,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
173
173
|
- !ruby/object:Gem::Version
|
|
174
174
|
version: '0'
|
|
175
175
|
requirements: []
|
|
176
|
-
rubygems_version:
|
|
176
|
+
rubygems_version: 4.0.2
|
|
177
177
|
specification_version: 4
|
|
178
178
|
summary: CBOR, Concise Binary Object Representation.
|
|
179
179
|
test_files:
|