ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
* [ruby-core:71248] [Ruby trunk - Bug #11632] [Open] Resolv::DNS::Message.encode fails to encode messages larger than 16383 byte
       [not found] <redmine.issue-11632.20151028145911@ruby-lang.org>
@ 2015-10-28 14:59 ` hannes.georg
  2015-10-28 22:01 ` [ruby-core:71255] [Ruby trunk - Bug #11632] " hannes.georg
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 4+ messages in thread
From: hannes.georg @ 2015-10-28 14:59 UTC (permalink / raw)
  To: ruby-core

Issue #11632 has been reported by Hannes Georg.

----------------------------------------
Bug #11632: Resolv::DNS::Message.encode fails to encode messages larger than 16383 byte
https://bugs.ruby-lang.org/issues/11632

* Author: Hannes Georg
* Status: Open
* Priority: Normal
* Assignee: 
* ruby -v: 
* Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN
----------------------------------------
Hello Rubyists

The ruby dns message encoder automatically remembers _all_ label addresses to be reused later ( see https://github.com/ruby/ruby/blob/v2_2_3/lib/resolv.rb#L1470 ). The address field however is limited to 14 bits ( see https://tools.ietf.org/html/rfc1035#section-4.1.4 ). If the message gets larger than 16383 bytes the addresses of new labels won't fit anymore. The encoder takes this into account and truncates the addresses on write which makes them invalid ( see https://github.com/ruby/ruby/blob/v2_2_3/lib/resolv.rb#L1467 ).

My suggested solution is to not store addresses larger than 16383. Is a github pr okay for that?



-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [ruby-core:71255] [Ruby trunk - Bug #11632] Resolv::DNS::Message.encode fails to encode messages larger than 16383 byte
       [not found] <redmine.issue-11632.20151028145911@ruby-lang.org>
  2015-10-28 14:59 ` [ruby-core:71248] [Ruby trunk - Bug #11632] [Open] Resolv::DNS::Message.encode fails to encode messages larger than 16383 byte hannes.georg
@ 2015-10-28 22:01 ` hannes.georg
  2015-11-09  9:21 ` [ruby-core:71411] " hannes.georg
  2015-11-12 11:47 ` [ruby-core:71463] " hannes.georg
  3 siblings, 0 replies; 4+ messages in thread
From: hannes.georg @ 2015-10-28 22:01 UTC (permalink / raw)
  To: ruby-core

Issue #11632 has been updated by Hannes Georg.


I've created a small script to demonstrate the behavior. The following script should print "test" but it prints some gibberish bytes in ruby 2.1.7 and 2.2.3.
~~~
require 'resolv'

msg = Resolv::DNS::Message.new
# this generates ~ 17000 bytes
500.times.each do |i|
  msg.add_answer("abcdefghijklmn%04d." % i,300,Resolv::DNS::Resource::IN::A.new("0.0.0.0"))
end
msg.add_answer("test.",300,Resolv::DNS::Resource::IN::A.new("0.0.0.0"))
msg.add_answer("test.",300,Resolv::DNS::Resource::IN::A.new("0.0.0.0"))
encoded = msg.encode
decoded = Resolv::DNS::Message.decode(encoded)
puts decoded.answer.last[0].to_s.inspect
~~~

----------------------------------------
Bug #11632: Resolv::DNS::Message.encode fails to encode messages larger than 16383 byte
https://bugs.ruby-lang.org/issues/11632#change-54627

* Author: Hannes Georg
* Status: Open
* Priority: Normal
* Assignee: 
* ruby -v: 
* Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN
----------------------------------------
Hello Rubyists

The ruby dns message encoder automatically remembers _all_ label addresses to be reused later ( see https://github.com/ruby/ruby/blob/v2_2_3/lib/resolv.rb#L1470 ). The address field however is limited to 14 bits ( see https://tools.ietf.org/html/rfc1035#section-4.1.4 ). If the message gets larger than 16383 bytes the addresses of new labels won't fit anymore. The encoder takes this into account and truncates the addresses on write which makes them invalid ( see https://github.com/ruby/ruby/blob/v2_2_3/lib/resolv.rb#L1467 ).

My suggested solution is to not store addresses larger than 16383. Is a github pr okay for that?



-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [ruby-core:71411] [Ruby trunk - Bug #11632] Resolv::DNS::Message.encode fails to encode messages larger than 16383 byte
       [not found] <redmine.issue-11632.20151028145911@ruby-lang.org>
  2015-10-28 14:59 ` [ruby-core:71248] [Ruby trunk - Bug #11632] [Open] Resolv::DNS::Message.encode fails to encode messages larger than 16383 byte hannes.georg
  2015-10-28 22:01 ` [ruby-core:71255] [Ruby trunk - Bug #11632] " hannes.georg
@ 2015-11-09  9:21 ` hannes.georg
  2015-11-12 11:47 ` [ruby-core:71463] " hannes.georg
  3 siblings, 0 replies; 4+ messages in thread
From: hannes.georg @ 2015-11-09  9:21 UTC (permalink / raw)
  To: ruby-core

Issue #11632 has been updated by Hannes Georg.


Pull submitted: https://github.com/ruby/ruby/pull/1088

----------------------------------------
Bug #11632: Resolv::DNS::Message.encode fails to encode messages larger than 16383 byte
https://bugs.ruby-lang.org/issues/11632#change-54781

* Author: Hannes Georg
* Status: Open
* Priority: Normal
* Assignee: 
* ruby -v: 
* Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN
----------------------------------------
Hello Rubyists

The ruby dns message encoder automatically remembers _all_ label addresses to be reused later ( see https://github.com/ruby/ruby/blob/v2_2_3/lib/resolv.rb#L1470 ). The address field however is limited to 14 bits ( see https://tools.ietf.org/html/rfc1035#section-4.1.4 ). If the message gets larger than 16383 bytes the addresses of new labels won't fit anymore. The encoder takes this into account and truncates the addresses on write which makes them invalid ( see https://github.com/ruby/ruby/blob/v2_2_3/lib/resolv.rb#L1467 ).

My suggested solution is to not store addresses larger than 16383. Is a github pr okay for that?



-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [ruby-core:71463] [Ruby trunk - Bug #11632] Resolv::DNS::Message.encode fails to encode messages larger than 16383 byte
       [not found] <redmine.issue-11632.20151028145911@ruby-lang.org>
                   ` (2 preceding siblings ...)
  2015-11-09  9:21 ` [ruby-core:71411] " hannes.georg
@ 2015-11-12 11:47 ` hannes.georg
  3 siblings, 0 replies; 4+ messages in thread
From: hannes.georg @ 2015-11-12 11:47 UTC (permalink / raw)
  To: ruby-core

Issue #11632 has been updated by Hannes Georg.


Cool, thank you!

----------------------------------------
Bug #11632: Resolv::DNS::Message.encode fails to encode messages larger than 16383 byte
https://bugs.ruby-lang.org/issues/11632#change-54834

* Author: Hannes Georg
* Status: Closed
* Priority: Normal
* Assignee: 
* ruby -v: 
* Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN
----------------------------------------
Hello Rubyists

The ruby dns message encoder automatically remembers _all_ label addresses to be reused later ( see https://github.com/ruby/ruby/blob/v2_2_3/lib/resolv.rb#L1470 ). The address field however is limited to 14 bits ( see https://tools.ietf.org/html/rfc1035#section-4.1.4 ). If the message gets larger than 16383 bytes the addresses of new labels won't fit anymore. The encoder takes this into account and truncates the addresses on write which makes them invalid ( see https://github.com/ruby/ruby/blob/v2_2_3/lib/resolv.rb#L1467 ).

My suggested solution is to not store addresses larger than 16383. Is a github pr okay for that?



-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-11-12 11:17 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <redmine.issue-11632.20151028145911@ruby-lang.org>
2015-10-28 14:59 ` [ruby-core:71248] [Ruby trunk - Bug #11632] [Open] Resolv::DNS::Message.encode fails to encode messages larger than 16383 byte hannes.georg
2015-10-28 22:01 ` [ruby-core:71255] [Ruby trunk - Bug #11632] " hannes.georg
2015-11-09  9:21 ` [ruby-core:71411] " hannes.georg
2015-11-12 11:47 ` [ruby-core:71463] " hannes.georg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).