[erlang-bugs] Unexpected crash using inet_res:lookup/3
Gustav Simonsson
gustav.simonsson@REDACTED
Mon Mar 12 12:31:20 CET 2012
Actually if you look at the typespec:
Name = dns_name() | inet:ip_address()
dns_name() = string()
A string with no adjacent dots.
// Gustav Simonsson
Sent from my PC
----- Original Message -----
> From: "Daniel Luna" <daniel@REDACTED>
> To: erlang-bugs@REDACTED
> Sent: Friday, 9 March, 2012 9:55:46 PM
> Subject: [erlang-bugs] Unexpected crash using inet_res:lookup/3
>
> Hi,
>
> inet_res:lookup/3 normally doesn't crash for almost any input (see
> examples 7-10 where I feed atoms and binaries to it).
>
> But in the case of a string starting with period or a containing a
> double period it will crash in inet_dns:encode_labels/4.
>
> No mention of this being expected in the documentation so assume that
> it's a bug. See examples below.
>
> Linux, R15B.
>
> Cheers,
>
> Daniel
>
>
> Erlang R15B (erts-5.9) [source] [64-bit] [smp:5:5] [async-threads:0]
> [kernel-poll:false]
>
> Eshell V5.9 (abort with ^G)
> 1> inet_res:lookup("erlang.com", in, mx).
> [{20,"mail.numbering.info"}]
> 2> inet_res:lookup("erlang..com", in, mx).
> ** exception error: no function clause matching
> inet_dns:encode_labels(<<0,2,1,0,0,1,0,0,0,0,0,0,6,101,114,108,97,110,103>>,
>
> {1,{[<<"erlang">>,<<>>,<<"com">>],12,nil,nil}},
> 19,
>
> [<<>>,<<"com">>]) (inet_dns.erl, line 693)
> in function inet_dns:encode_name/4 (inet_dns.erl, line 674)
> in call from inet_dns:encode_query_section/3 (inet_dns.erl, line
> 268)
> in call from inet_dns:encode/1 (inet_dns.erl, line 239)
> in call from inet_res:make_query/5 (inet_res.erl, line 669)
> in call from inet_res:make_query/4 (inet_res.erl, line 637)
> in call from inet_res:res_query/5 (inet_res.erl, line 608)
> in call from inet_res:resolve/5 (inet_res.erl, line 141)
> 3> inet_res:lookup("..", in, mx).
> ** exception error: no function clause matching
> inet_dns:encode_labels(<<0,3,1,0,0,1,0,0,0,0,0,0>>,{0,nil},12,[<<>>,<<>>])
> (inet_dns.erl, line 693)
> in function inet_dns:encode_name/4 (inet_dns.erl, line 674)
> in call from inet_dns:encode_query_section/3 (inet_dns.erl, line
> 268)
> in call from inet_dns:encode/1 (inet_dns.erl, line 239)
> in call from inet_res:make_query/5 (inet_res.erl, line 669)
> in call from inet_res:make_query/4 (inet_res.erl, line 637)
> in call from inet_res:res_query/5 (inet_res.erl, line 608)
> in call from inet_res:resolve/5 (inet_res.erl, line 141)
> 4> inet_res:lookup(".", in, mx).
> []
> 5> inet_res:lookup(".com", in, mx).
> ** exception error: no function clause matching
> inet_dns:encode_labels(<<0,5,1,0,0,1,0,0,0,0,0,0>>,{0,nil},12,[<<>>,<<"com">>])
> (inet_dns.erl, line 693)
> in function inet_dns:encode_name/4 (inet_dns.erl, line 674)
> in call from inet_dns:encode_query_section/3 (inet_dns.erl, line
> 268)
> in call from inet_dns:encode/1 (inet_dns.erl, line 239)
> in call from inet_res:make_query/5 (inet_res.erl, line 669)
> in call from inet_res:make_query/4 (inet_res.erl, line 637)
> in call from inet_res:res_query/5 (inet_res.erl, line 608)
> in call from inet_res:resolve/5 (inet_res.erl, line 141)
> 6> inet_res:lookup("erlang.", in, mx).
> []
> 7> inet_res:lookup([1234567], in, mx).
> []
> 8> inet_res:lookup([atom], in, mx).
> []
> 9> inet_res:lookup(atom, in, mx).
> []
> 10> inet_res:lookup(<<"binary">>, in, mx).
> []
> _______________________________________________
> erlang-bugs mailing list
> erlang-bugs@REDACTED
> http://erlang.org/mailman/listinfo/erlang-bugs
>
More information about the erlang-bugs
mailing list