bencode_ext 0.2.0 → 0.2.1

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.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.0
1
+ 0.2.1
data/bencode_ext.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{bencode_ext}
8
- s.version = "0.2.0"
8
+ s.version = "0.2.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["naquad"]
@@ -87,6 +87,8 @@ static VALUE decode(VALUE self, VALUE encoded){
87
87
  crt = *str == 'l' ? rb_ary_new() : rb_hash_new();
88
88
  NEXT_CHAR;
89
89
  if(NIL_P(current_container)){
90
+ if(max_depth == 0)
91
+ rb_raise(DecodeError, "Structure is too deep!");
90
92
  ret = current_container = crt;
91
93
  continue;
92
94
  }
@@ -31,6 +31,10 @@ class TestBencodeExt < Test::Unit::TestCase
31
31
  BEncode.max_depth = 1
32
32
  'lli1eee'.bdecode
33
33
  end
34
+ assert_raises(BEncode::DecodeError) do
35
+ BEncode.max_depth = 0
36
+ 'li1ee'.bdecode
37
+ end
34
38
  assert_nothing_raised(BEncode::DecodeError) do
35
39
  BEncode.max_depth = 0
36
40
  'i1e'.bdecode
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 2
8
- - 0
9
- version: 0.2.0
8
+ - 1
9
+ version: 0.2.1
10
10
  platform: ruby
11
11
  authors:
12
12
  - naquad