xdr 2.0.0 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/CHANGELOG.md +5 -0
- data/lib/xdr/concerns/reads_bytes.rb +8 -0
- data/lib/xdr/opaque.rb +1 -1
- data/lib/xdr/string.rb +1 -1
- data/lib/xdr/var_opaque.rb +1 -1
- data/lib/xdr/version.rb +1 -1
- data/spec/lib/xdr/concerns/reads_bytes_spec.rb +26 -0
- data/spec/lib/xdr/opaque_spec.rb +4 -0
- data/spec/lib/xdr/string_spec.rb +6 -0
- data/spec/lib/xdr/var_opaque_spec.rb +7 -0
- data/xdr.gemspec +2 -2
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 0d5bbd8152326ee17057091ea8a9ec722f07ad88c74bf9717b16cdab900401e5
|
4
|
+
data.tar.gz: 60dfea4235d890dc70553903b5130ed05e5c98e83bc3586ecf0bd7e447cb205e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d74217c94b1cbb5a7e0c6b1bcf14547c5b5d186b6bcabe6c078b5d941ac3953dd32ab652f151f8ed970c8c6fc92cbcee2e7608ab6c3b3d57e6d7de1080a780e6
|
7
|
+
data.tar.gz: cf5d7fd46ef66e83c70860d52ef50dab523af310ab2aba5f7cc06543791adac5d8afbefd8480734f1a34259ecdd2da2c5921f30e90fc84113f89bb006ae5d7de
|
data/CHANGELOG.md
CHANGED
@@ -6,6 +6,11 @@ file. This project adheres to [Semantic Versioning](http://semver.org/).
|
|
6
6
|
As this project is pre 1.0, breaking changes may happen for minor version
|
7
7
|
bumps. A breaking change will get clearly notified in this log.
|
8
8
|
|
9
|
+
## [Unreleased](https://github.com/stellar/ruby-stellar-base/compare/v1.0.0...master)
|
10
|
+
|
11
|
+
### Fixed
|
12
|
+
- Padding bytes are now properly validated when reading xdr values. According to the XDR spec, padding must be zeros.
|
13
|
+
|
9
14
|
## [1.0.0](https://github.com/stellar/ruby-stellar-base/compare/v0.1.0...v1.0.0)
|
10
15
|
|
11
16
|
### Added
|
data/lib/xdr/opaque.rb
CHANGED
data/lib/xdr/string.rb
CHANGED
data/lib/xdr/var_opaque.rb
CHANGED
data/lib/xdr/version.rb
CHANGED
@@ -3,6 +3,7 @@ require 'spec_helper'
|
|
3
3
|
class TestReader
|
4
4
|
include XDR::Concerns::ReadsBytes
|
5
5
|
public :read_bytes
|
6
|
+
public :read_zeros
|
6
7
|
end
|
7
8
|
|
8
9
|
|
@@ -28,4 +29,29 @@ describe XDR::Concerns::ReadsBytes, "#read_bytes" do
|
|
28
29
|
io = StringIO.new(str)
|
29
30
|
subject.read_bytes(io, length)
|
30
31
|
end
|
32
|
+
end
|
33
|
+
|
34
|
+
|
35
|
+
describe XDR::Concerns::ReadsBytes, "#read_zeros" do
|
36
|
+
subject{ TestReader.new }
|
37
|
+
|
38
|
+
it "raises XDR::ReadError when the bytes read do not equal zero" do
|
39
|
+
expect{ read("\x01", 1) }.to raise_error(XDR::ReadError)
|
40
|
+
end
|
41
|
+
|
42
|
+
it "succeeds when all the bytes read are zero" do
|
43
|
+
expect{ read("\x00\x00\x00\x00", 1) }.to_not raise_error
|
44
|
+
expect{ read("\x00\x00\x00\x00", 2) }.to_not raise_error
|
45
|
+
expect{ read("\x00\x00\x00\x00", 3) }.to_not raise_error
|
46
|
+
expect{ read("\x00\x00\x00\x00", 4) }.to_not raise_error
|
47
|
+
end
|
48
|
+
|
49
|
+
it "raises EOFError when the requested length goes beyond the length of the stream" do
|
50
|
+
expect{ read("\x00\x00\x00\x00", 5) }.to raise_error(EOFError)
|
51
|
+
end
|
52
|
+
|
53
|
+
def read(str, length)
|
54
|
+
io = StringIO.new(str)
|
55
|
+
subject.read_zeros(io, length)
|
56
|
+
end
|
31
57
|
end
|
data/spec/lib/xdr/opaque_spec.rb
CHANGED
@@ -9,6 +9,10 @@ describe XDR::Opaque, "#read" do
|
|
9
9
|
expect(read("\x00\x01\x00\x00")).to eq("\x00\x01\x00")
|
10
10
|
end
|
11
11
|
|
12
|
+
it "raises a ReadError when the padding isn't zeros" do
|
13
|
+
expect{ read "\x00\x00\x01\x01" }.to raise_error(XDR::ReadError)
|
14
|
+
end
|
15
|
+
|
12
16
|
def read(str)
|
13
17
|
io = StringIO.new(str)
|
14
18
|
subject.read(io)
|
data/spec/lib/xdr/string_spec.rb
CHANGED
@@ -14,6 +14,12 @@ describe XDR::String, "#read" do
|
|
14
14
|
expect{ read "\x00\x00\x00\x04hiya" }.to raise_error(XDR::ReadError)
|
15
15
|
end
|
16
16
|
|
17
|
+
it "raises a ReadError when the padding isn't zeros" do
|
18
|
+
expect{ read "\x00\x00\x00\x01h\x00\x00\x01" }.to raise_error(XDR::ReadError)
|
19
|
+
expect{ read "\x00\x00\x00\x01h\x00\x01\x00" }.to raise_error(XDR::ReadError)
|
20
|
+
expect{ read "\x00\x00\x00\x01h\x01\x00\x00" }.to raise_error(XDR::ReadError)
|
21
|
+
end
|
22
|
+
|
17
23
|
def read(str)
|
18
24
|
io = StringIO.new(str)
|
19
25
|
subject.read(io)
|
@@ -15,6 +15,13 @@ describe XDR::VarOpaque, "#read" do
|
|
15
15
|
expect{ read "\x00\x00\x00\x03\x00\x00\x00\x00" }.to raise_error(XDR::ReadError)
|
16
16
|
end
|
17
17
|
|
18
|
+
|
19
|
+
it "raises a ReadError when the padding isn't zeros" do
|
20
|
+
expect{ read "\x00\x00\x00\x01\x01\x00\x00\x01" }.to raise_error(XDR::ReadError)
|
21
|
+
expect{ read "\x00\x00\x00\x01\x01\x00\x01\x00" }.to raise_error(XDR::ReadError)
|
22
|
+
expect{ read "\x00\x00\x00\x01\x01\x01\x00\x00" }.to raise_error(XDR::ReadError)
|
23
|
+
end
|
24
|
+
|
18
25
|
def read(str)
|
19
26
|
io = StringIO.new(str)
|
20
27
|
subject.read(io)
|
data/xdr.gemspec
CHANGED
@@ -17,8 +17,8 @@ Gem::Specification.new do |spec|
|
|
17
17
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
19
|
spec.require_paths = ["lib"]
|
20
|
-
spec.add_dependency "activesupport", ">=
|
21
|
-
spec.add_dependency "activemodel", ">=
|
20
|
+
spec.add_dependency "activesupport", ">= 5.2.0"
|
21
|
+
spec.add_dependency "activemodel", ">= 5.2.0"
|
22
22
|
|
23
23
|
spec.add_development_dependency "bundler", "~> 1.7"
|
24
24
|
spec.add_development_dependency "rake", "~> 10.0"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: xdr
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 3.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Scott Fleckenstein
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-07-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -16,28 +16,28 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 5.2.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: 5.2.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: activemodel
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
33
|
+
version: 5.2.0
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
40
|
+
version: 5.2.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: bundler
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -210,7 +210,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
210
210
|
version: '0'
|
211
211
|
requirements: []
|
212
212
|
rubyforge_project:
|
213
|
-
rubygems_version: 2.
|
213
|
+
rubygems_version: 2.7.6
|
214
214
|
signing_key:
|
215
215
|
specification_version: 4
|
216
216
|
summary: XDR Helper Library
|