cbor 0.5.9.3 → 0.5.9.4
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/README.rdoc +1 -1
- data/cbor.gemspec +3 -3
- data/ext/cbor/unpacker.c +9 -2
- data/lib/cbor/version.rb +1 -1
- data/spec/format_spec.rb +23 -0
- metadata +6 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a2c92fadfe4835b40910e13f19e471916c9e138f5087d068f4dce3aa59c72eee
|
4
|
+
data.tar.gz: 5295a488ba1a015a720829da251462cead06eefc395cbe99e68a9049660eb902
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7b63dba28e71e57bd0d8440c6746ca566deb131e38c1052a0819d99f9eee6b666bfe8e2e1fc61cfd9eba3e2f4844ee4d5071dc6977ee1342e42fc5b9305e2e93
|
7
|
+
data.tar.gz: 834dd54d18ca973f71726ddbc57fc47d6e32e2441152ad6a88c969b4a364672a6f36c9739cfa35dc06a552fbf2cb1d8c66050272f41174c585280477282b000d
|
data/README.rdoc
CHANGED
@@ -58,7 +58,7 @@ Author:: Carsten Bormann <cabo@tzi.org>
|
|
58
58
|
Copyright:: Copyright (c) 2013, 2014 Carsten Bormann
|
59
59
|
License:: Apache License, Version 2.0
|
60
60
|
|
61
|
-
{<img src="https://travis-ci.org/cabo/cbor-ruby.
|
61
|
+
{<img src="https://travis-ci.org/cabo/cbor-ruby.svg?branch=master" />}[https://travis-ci.org/cabo/cbor-ruby] {<img src="https://badge.fury.io/rb/cbor.svg" alt="Gem Version" />}[http://badge.fury.io/rb/cbor]
|
62
62
|
|
63
63
|
For the original, see below.
|
64
64
|
|
data/cbor.gemspec
CHANGED
@@ -8,9 +8,9 @@ Gem::Specification.new do |s|
|
|
8
8
|
s.description = %q{CBOR is a library for the CBOR binary object representation format, based on Sadayuki Furuhashi's MessagePack library.}
|
9
9
|
s.author = "Carsten Bormann, standing on the tall shoulders of Sadayuki Furuhashi"
|
10
10
|
s.email = "cabo@tzi.org"
|
11
|
-
s.license = "Apache
|
11
|
+
s.license = "Apache-2.0"
|
12
12
|
s.homepage = "http://cbor.io/"
|
13
|
-
s.has_rdoc = false
|
13
|
+
# s.has_rdoc = false
|
14
14
|
s.files = `git ls-files`.split("\n")
|
15
15
|
s.test_files = `git ls-files -- {test,spec}/*`.split("\n")
|
16
16
|
s.require_paths = ["lib"]
|
@@ -21,5 +21,5 @@ Gem::Specification.new do |s|
|
|
21
21
|
s.add_development_dependency 'rake-compiler', ['~> 0.8.3']
|
22
22
|
s.add_development_dependency 'rspec', ['~> 2.11']
|
23
23
|
s.add_development_dependency 'json', ['~> 1.7']
|
24
|
-
s.add_development_dependency 'yard', ['~> 0.
|
24
|
+
s.add_development_dependency 'yard', ['~> 0.9.11']
|
25
25
|
end
|
data/ext/cbor/unpacker.c
CHANGED
@@ -29,6 +29,13 @@
|
|
29
29
|
#include "rmem.h"
|
30
30
|
#include <math.h> /* for ldexp */
|
31
31
|
|
32
|
+
/* work around https://bugs.ruby-lang.org/issues/15779 for now
|
33
|
+
* by limiting preallocation to about a Tebibyte
|
34
|
+
* limit is 2**n-1 (n==10) so we can avoid a conditional
|
35
|
+
*/
|
36
|
+
#define SANE_PREALLOCATION_MAX 0xFFFFFFFFFFUL
|
37
|
+
#define SANE_PREALLOCATE(n) (n & SANE_PREALLOCATION_MAX)
|
38
|
+
|
32
39
|
#if !defined(DISABLE_RMEM) && !defined(DISABLE_UNPACKER_STACK_RMEM) && \
|
33
40
|
MSGPACK_UNPACKER_STACK_CAPACITY * MSGPACK_UNPACKER_STACK_SIZE <= MSGPACK_RMEM_PAGE_SIZE
|
34
41
|
#define UNPACKER_STACK_RMEM
|
@@ -245,7 +252,7 @@ static int read_raw_body_cont(msgpack_unpacker_t* uk, int textflag)
|
|
245
252
|
size_t length = uk->reading_raw_remaining;
|
246
253
|
|
247
254
|
if(uk->reading_raw == Qnil) {
|
248
|
-
uk->reading_raw = rb_str_buf_new(length);
|
255
|
+
uk->reading_raw = rb_str_buf_new(SANE_PREALLOCATE(length));
|
249
256
|
}
|
250
257
|
|
251
258
|
do {
|
@@ -381,7 +388,7 @@ static int read_primitive(msgpack_unpacker_t* uk)
|
|
381
388
|
if (val == 0) {
|
382
389
|
return object_complete(uk, rb_ary_new());
|
383
390
|
}
|
384
|
-
return _msgpack_unpacker_stack_push(uk, STACK_TYPE_ARRAY, val, rb_ary_new2(val));
|
391
|
+
return _msgpack_unpacker_stack_push(uk, STACK_TYPE_ARRAY, val, rb_ary_new2(SANE_PREALLOCATE(val)));
|
385
392
|
CASE_AI(MT_MAP):
|
386
393
|
READ_VAL(uk, ai, val);
|
387
394
|
CASE_IMM(MT_MAP): // map
|
data/lib/cbor/version.rb
CHANGED
data/spec/format_spec.rb
CHANGED
@@ -421,6 +421,29 @@ describe MessagePack do
|
|
421
421
|
unpacker.feed(CBOR.encode(symbolized_hash)).read.should == symbolized_hash
|
422
422
|
end
|
423
423
|
|
424
|
+
it 'handle outrageous sizes' do
|
425
|
+
expect { CBOR.decode("\xa1") }.to raise_error(EOFError)
|
426
|
+
expect { CBOR.decode("\xba\xff\xff\xff\xff") }.to raise_error(EOFError)
|
427
|
+
expect { CBOR.decode("\xbb\xff\xff\xff\xff\xff\xff\xff\xff") }.to raise_error(EOFError)
|
428
|
+
expect { CBOR.decode("\xbb\x01\x01\x01\x01\x01\x01\x01\x01") }.to raise_error(EOFError)
|
429
|
+
expect { CBOR.decode("\xbb\x00\x00\x01\x01\x01\x01\x01\x01") }.to raise_error(EOFError)
|
430
|
+
expect { CBOR.decode("\x81") }.to raise_error(EOFError)
|
431
|
+
expect { CBOR.decode("\x9a\xff\xff\xff\xff") }.to raise_error(EOFError)
|
432
|
+
expect { CBOR.decode("\x9b\xff\xff\xff\xff\xff\xff\xff\xff") }.to raise_error(EOFError)
|
433
|
+
expect { CBOR.decode("\x9b\x01\x01\x01\x01\x01\x01\x01\x01") }.to raise_error(EOFError)
|
434
|
+
expect { CBOR.decode("\x9b\x00\x00\x01\x01\x01\x01\x01\x01") }.to raise_error(EOFError)
|
435
|
+
expect { CBOR.decode("\x61") }.to raise_error(EOFError)
|
436
|
+
expect { CBOR.decode("\x7a\xff\xff\xff\xff") }.to raise_error(EOFError)
|
437
|
+
expect { CBOR.decode("\x7b\xff\xff\xff\xff\xff\xff\xff\xff") }.to raise_error(EOFError)
|
438
|
+
expect { CBOR.decode("\x7b\x01\x01\x01\x01\x01\x01\x01\x01") }.to raise_error(EOFError)
|
439
|
+
expect { CBOR.decode("\x7b\x00\x00\x01\x01\x01\x01\x01\x01") }.to raise_error(EOFError)
|
440
|
+
expect { CBOR.decode("\x41") }.to raise_error(EOFError)
|
441
|
+
expect { CBOR.decode("\x5a\xff\xff\xff\xff") }.to raise_error(EOFError)
|
442
|
+
expect { CBOR.decode("\x5b\xff\xff\xff\xff\xff\xff\xff\xff") }.to raise_error(EOFError)
|
443
|
+
expect { CBOR.decode("\x5b\x01\x01\x01\x01\x01\x01\x01\x01") }.to raise_error(EOFError)
|
444
|
+
expect { CBOR.decode("\x5b\x00\x00\x01\x01\x01\x01\x01\x01") }.to raise_error(EOFError)
|
445
|
+
end
|
446
|
+
|
424
447
|
|
425
448
|
## FIXME
|
426
449
|
# it "{0=>0, 1=>1, ..., 14=>14}" do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cbor
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.9.
|
4
|
+
version: 0.5.9.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Carsten Bormann, standing on the tall shoulders of Sadayuki Furuhashi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-06-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -86,14 +86,14 @@ dependencies:
|
|
86
86
|
requirements:
|
87
87
|
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: 0.
|
89
|
+
version: 0.9.11
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: 0.
|
96
|
+
version: 0.9.11
|
97
97
|
description: CBOR is a library for the CBOR binary object representation format, based
|
98
98
|
on Sadayuki Furuhashi's MessagePack library.
|
99
99
|
email: cabo@tzi.org
|
@@ -158,7 +158,7 @@ files:
|
|
158
158
|
- spec/unpacker_spec.rb
|
159
159
|
homepage: http://cbor.io/
|
160
160
|
licenses:
|
161
|
-
- Apache
|
161
|
+
- Apache-2.0
|
162
162
|
metadata: {}
|
163
163
|
post_install_message:
|
164
164
|
rdoc_options: []
|
@@ -175,8 +175,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
175
175
|
- !ruby/object:Gem::Version
|
176
176
|
version: '0'
|
177
177
|
requirements: []
|
178
|
-
|
179
|
-
rubygems_version: 2.7.6
|
178
|
+
rubygems_version: 3.0.3
|
180
179
|
signing_key:
|
181
180
|
specification_version: 4
|
182
181
|
summary: CBOR, Concise Binary Object Representation.
|