merge revision(s) r44884: [Backport #9498]

* lib/resolv.rb (Resolv::DNS::Message::MessageDecoder): Raise
	  DecodeError if no data before the limit.
	  Reported by Will Bryant.  [ruby-core:60557] [Bug #9498]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_0_0@44976 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nagachika 2014-02-15 14:59:17 +00:00
parent f9acab1f42
commit d9e36580ef
3 changed files with 10 additions and 1 deletions

View file

@ -1,3 +1,9 @@
Sat Feb 15 23:58:31 2014 Tanaka Akira <akr@fsij.org>
* lib/resolv.rb (Resolv::DNS::Message::MessageDecoder): Raise
DecodeError if no data before the limit.
Reported by Will Bryant. [ruby-core:60557] [Bug #9498]
Sat Feb 15 23:46:31 2014 Nobuyoshi Nakada <nobu@ruby-lang.org> Sat Feb 15 23:46:31 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
* parse.y (IDSET_ATTRSET_FOR_INTERN): fix off-by-one bug. * parse.y (IDSET_ATTRSET_FOR_INTERN): fix off-by-one bug.

View file

@ -1489,6 +1489,7 @@ class Resolv
end end
def get_bytes(len = @limit - @index) def get_bytes(len = @limit - @index)
raise DecodeError.new("limit exceeded") if @limit < @index + len
d = @data[@index, len] d = @data[@index, len]
@index += len @index += len
return d return d
@ -1516,6 +1517,7 @@ class Resolv
end end
def get_string def get_string
raise DecodeError.new("limit exceeded") if @limit <= @index
len = @data[@index].ord len = @data[@index].ord
raise DecodeError.new("limit exceeded") if @limit < @index + 1 + len raise DecodeError.new("limit exceeded") if @limit < @index + 1 + len
d = @data[@index + 1, len] d = @data[@index + 1, len]
@ -1539,6 +1541,7 @@ class Resolv
limit = @index if !limit || @index < limit limit = @index if !limit || @index < limit
d = [] d = []
while true while true
raise DecodeError.new("limit exceeded") if @limit <= @index
case @data[@index].ord case @data[@index].ord
when 0 when 0
@index += 1 @index += 1

View file

@ -1,6 +1,6 @@
#define RUBY_VERSION "2.0.0" #define RUBY_VERSION "2.0.0"
#define RUBY_RELEASE_DATE "2014-02-15" #define RUBY_RELEASE_DATE "2014-02-15"
#define RUBY_PATCHLEVEL 410 #define RUBY_PATCHLEVEL 411
#define RUBY_RELEASE_YEAR 2014 #define RUBY_RELEASE_YEAR 2014
#define RUBY_RELEASE_MONTH 2 #define RUBY_RELEASE_MONTH 2