diff options
author | Micael Karlberg <[email protected]> | 2019-07-30 17:18:01 +0200 |
---|---|---|
committer | Micael Karlberg <[email protected]> | 2019-07-30 17:18:01 +0200 |
commit | b8689708139b10a08e11adf4ffea4dc8fe31cd07 (patch) | |
tree | e4d15c419ad077ea82d43480beab4bcbad75e386 /erts | |
parent | c2a0eabf7d006856906fd5586cfa5507e922ad2a (diff) | |
parent | ae6eb243f95d4fb1bdc83d31613a36c53323b9ee (diff) | |
download | otp-b8689708139b10a08e11adf4ffea4dc8fe31cd07.tar.gz otp-b8689708139b10a08e11adf4ffea4dc8fe31cd07.tar.bz2 otp-b8689708139b10a08e11adf4ffea4dc8fe31cd07.zip |
Merge branch 'bmk/erts/esock/20190724/invalid_sockaddr_null_in_sendto' into maint
Diffstat (limited to 'erts')
-rw-r--r-- | erts/preloaded/ebin/socket.beam | bin | 76476 -> 76028 bytes | |||
-rw-r--r-- | erts/preloaded/src/Makefile | 10 | ||||
-rw-r--r-- | erts/preloaded/src/socket.erl | 31 |
3 files changed, 21 insertions, 20 deletions
diff --git a/erts/preloaded/ebin/socket.beam b/erts/preloaded/ebin/socket.beam Binary files differindex 408c51b57a..eafd7a97b2 100644 --- a/erts/preloaded/ebin/socket.beam +++ b/erts/preloaded/ebin/socket.beam diff --git a/erts/preloaded/src/Makefile b/erts/preloaded/src/Makefile index e1bb2ee5c4..38b85915cc 100644 --- a/erts/preloaded/src/Makefile +++ b/erts/preloaded/src/Makefile @@ -95,6 +95,15 @@ ERL_COMPILE_FLAGS += +debug_info -I$(KERNEL_SRC) -I$(KERNEL_INCLUDE) DIA_PLT = erts-preloaded.plt DIA_ANALYSIS = $(basename $(DIA_PLT)).dialyzer_analysis +ifeq ($(DIAW_EH),true) +DIA_WARNINGS += -Werror_handling +endif +ifeq ($(DIAW_US),true) +DIA_WARNINGS += -Wunderspecs +endif +ifeq ($(DIAW_UR),true) +DIA_WARNINGS += -Wunmatched_returns +endif debug opt: $(TARGET_FILES) @@ -144,6 +153,7 @@ dialyzer: $(DIA_PLT) @echo "Running dialyzer on $(basename $(DIA_PLT))" @dialyzer --plt $< \ ../ebin \ + $(DIA_WARNINGS) \ --verbose # diff --git a/erts/preloaded/src/socket.erl b/erts/preloaded/src/socket.erl index b9b67f25b4..e01c85d5d1 100644 --- a/erts/preloaded/src/socket.erl +++ b/erts/preloaded/src/socket.erl @@ -1567,7 +1567,7 @@ do_send(SockRef, Data, EFlags, Timeout) -> ok | {error, Reason} when Socket :: socket(), Data :: binary(), - Dest :: null | sockaddr(), + Dest :: sockaddr(), Reason :: term(). sendto(Socket, Data, Dest) -> @@ -1576,7 +1576,7 @@ sendto(Socket, Data, Dest) -> -spec sendto(Socket, Data, Dest, Flags) -> ok | {error, Reason} when Socket :: socket(), Data :: binary(), - Dest :: null | sockaddr(), + Dest :: sockaddr(), Flags :: send_flags(), Reason :: term() ; (Socket, Data, Dest, Timeout :: nowait) -> ok | @@ -1584,13 +1584,13 @@ sendto(Socket, Data, Dest) -> {error, Reason} when Socket :: socket(), Data :: iodata(), - Dest :: null | sockaddr(), + Dest :: sockaddr(), SelectInfo :: select_info(), Reason :: term() ; (Socket, Data, Dest, Timeout) -> ok | {error, Reason} when Socket :: socket(), Data :: iodata(), - Dest :: null | sockaddr(), + Dest :: sockaddr(), Timeout :: timeout(), Reason :: term(). @@ -1605,14 +1605,14 @@ sendto(Socket, Data, Dest, Timeout) -> {error, Reason} when Socket :: socket(), Data :: binary(), - Dest :: null | sockaddr(), + Dest :: sockaddr(), Flags :: send_flags(), SelectInfo :: select_info(), Reason :: term() ; (Socket, Data, Dest, Flags, Timeout) -> ok | {error, Reason} when Socket :: socket(), Data :: binary(), - Dest :: null | sockaddr(), + Dest :: sockaddr(), Flags :: send_flags(), Timeout :: timeout(), Reason :: term(). @@ -1620,15 +1620,6 @@ sendto(Socket, Data, Dest, Timeout) -> sendto(Socket, Data, Dest, Flags, Timeout) when is_list(Data) -> Bin = erlang:list_to_binary(Data), sendto(Socket, Bin, Dest, Flags, Timeout); -sendto(#socket{ref = SockRef}, Data, Dest, Flags, Timeout) - when is_binary(Data) andalso - (Dest =:= null) andalso - is_list(Flags) andalso - ((Timeout =:= nowait) orelse - (Timeout =:= infinity) orelse - (is_integer(Timeout) andalso (Timeout > 0))) -> - EFlags = enc_send_flags(Flags), - do_sendto(SockRef, Data, ensure_sockaddr(Dest), EFlags, Timeout); sendto(#socket{ref = SockRef}, Data, #{family := Fam} = Dest, Flags, Timeout) when is_binary(Data) andalso ((Fam =:= inet) orelse (Fam =:= inet6) orelse (Fam =:= local)) andalso @@ -2705,17 +2696,17 @@ cancel(#socket{ref = SockRef}, #select_info{tag = Tag, ref = Ref}) -> %% %% =========================================================================== --spec enc_domain(Domain) -> non_neg_integer() when - Domain :: domain(). +%% -spec enc_domain(Domain) -> non_neg_integer() when +%% Domain :: domain(). enc_domain(local) -> ?SOCKET_DOMAIN_LOCAL; enc_domain(inet) -> ?SOCKET_DOMAIN_INET; enc_domain(inet6) -> ?SOCKET_DOMAIN_INET6; enc_domain(Domain) -> invalid_domain(Domain). --spec enc_type(Domain, Type) -> non_neg_integer() when - Domain :: domain(), - Type :: type(). +%% -spec enc_type(Domain, Type) -> non_neg_integer() when +%% Domain :: domain(), +%% Type :: type(). %% What combos are valid? enc_type(_, stream) -> ?SOCKET_TYPE_STREAM; |