ruby-changes:32805
From: akr <ko1@a...>
Date: Sat, 8 Feb 2014 15:29:58 +0900 (JST)
Subject: [ruby-changes:32805] akr:r44884 (trunk): * lib/resolv.rb (Resolv::DNS::Message::MessageDecoder): Raise
akr 2014-02-08 15:29:54 +0900 (Sat, 08 Feb 2014) New Revision: 44884 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=44884 Log: * lib/resolv.rb (Resolv::DNS::Message::MessageDecoder): Raise DecodeError if no data before the limit. Reported by Will Bryant. [ruby-core:60557] [Bug #9498] Modified files: trunk/ChangeLog trunk/lib/resolv.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 44883) +++ ChangeLog (revision 44884) @@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Sat Feb 8 15:27:02 2014 Tanaka Akira <akr@f...> + + * 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 8 15:11:21 2014 Tanaka Akira <akr@f...> * io.c (SMALLBUF): Unused macro removed. Index: lib/resolv.rb =================================================================== --- lib/resolv.rb (revision 44883) +++ lib/resolv.rb (revision 44884) @@ -1528,6 +1528,7 @@ class Resolv https://github.com/ruby/ruby/blob/trunk/lib/resolv.rb#L1528 end def get_bytes(len = @limit - @index) + raise DecodeError.new("limit exceeded") if @limit < @index + len d = @data[@index, len] @index += len return d @@ -1555,6 +1556,7 @@ class Resolv https://github.com/ruby/ruby/blob/trunk/lib/resolv.rb#L1556 end def get_string + raise DecodeError.new("limit exceeded") if @limit <= @index len = @data[@index].ord raise DecodeError.new("limit exceeded") if @limit < @index + 1 + len d = @data[@index + 1, len] @@ -1578,6 +1580,7 @@ class Resolv https://github.com/ruby/ruby/blob/trunk/lib/resolv.rb#L1580 limit = @index if !limit || @index < limit d = [] while true + raise DecodeError.new("limit exceeded") if @limit <= @index case @data[@index].ord when 0 @index += 1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/