Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:Ledest:erlang:26
erlang
3038-Fix-handling-of-invalid-package-at-stream-...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 3038-Fix-handling-of-invalid-package-at-stream-end.patch of Package erlang
From ffc392c44b1485f6d3d45bf6e693d56e22f3bc8b Mon Sep 17 00:00:00 2001 From: Raimo Niskanen <raimo@erlang.org> Date: Fri, 23 Feb 2024 17:29:42 +0100 Subject: [PATCH 08/22] Fix handling of invalid package at stream end --- lib/kernel/src/gen_tcp_socket.erl | 17 +++++++++-------- lib/kernel/test/gen_tcp_misc_SUITE.erl | 2 +- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/lib/kernel/src/gen_tcp_socket.erl b/lib/kernel/src/gen_tcp_socket.erl index daf0c5d823..a9c9317ca2 100644 --- a/lib/kernel/src/gen_tcp_socket.erl +++ b/lib/kernel/src/gen_tcp_socket.erl @@ -2383,13 +2383,10 @@ handle_recv_packet(P, D, ActionsR) -> handle_recv_deliver(P, D_1, ActionsR, Decoded); {D_1, more, Missing} -> handle_recv_more(P, D_1, Missing, ActionsR); + {D_1, error, invalid} -> + handle_recv_error(P, D_1, ActionsR, emsgsize); {D_1, error, Reason} -> - handle_recv_error( - P, D_1, ActionsR, - case Reason of - invalid -> emsgsize; - _ -> Reason - end) + handle_recv_error(P, D_1, ActionsR, Reason) end. handle_recv_error_packet(P, D, ActionsR, Reason) -> @@ -2398,6 +2395,8 @@ handle_recv_error_packet(P, D, ActionsR, Reason) -> handle_recv_error( P, recv_data_deliver(P, D_1, ActionsR, Decoded), Reason); + {D_1, error, invalid} -> + handle_recv_error(P, D_1, ActionsR, emsgsize); {D_1, _, _} -> handle_recv_error(P, D_1, ActionsR, Reason) end. @@ -2440,12 +2439,13 @@ decode_packet(D, PacketType, Buffer, Options) -> erlang:decode_packet(PacketType, CondensedBuffer, Options) of {ok, Decoded, Rest} -> + %% ?DBG({ok, PacketType, byte_size(Decoded)}), {D#{buffer := Rest}, ok, Decoded}; Other when is_binary(Buffer) -> - %% ?DBG({decode_packet, byte_size(CondensedBuffer), Other}), + %% ?DBG({Other, PacketType, byte_size(CondensedBuffer)}), decode_packet(D, Other); Other when is_list(Buffer) -> - %% ?DBG({decode_packet, byte_size(CondensedBuffer), Other}), + %% ?DBG({Other, PacketType, byte_size(CondensedBuffer)}), decode_packet(D#{buffer := CondensedBuffer}, Other) end. %% @@ -2471,6 +2471,7 @@ handle_recv_error( %% %% Send active socket messages %% + %% ?DBG({Active, ShowEconnreset, ActionsR, Reason}), ModuleSocket = module_socket(P), Owner = P#params.owner, if diff --git a/lib/kernel/test/gen_tcp_misc_SUITE.erl b/lib/kernel/test/gen_tcp_misc_SUITE.erl index 814c79bcb8..4b8ca6fc84 100644 --- a/lib/kernel/test/gen_tcp_misc_SUITE.erl +++ b/lib/kernel/test/gen_tcp_misc_SUITE.erl @@ -7760,7 +7760,7 @@ otp_8102(Config) when is_list(Config) -> ?TC_TRY(?FUNCTION_NAME, Cond, Pre, TC, Post). do_otp_8102(Config, Addr) -> - {ok, LSocket} = ?LISTEN(Config, 0, [{ip, Addr}]), + {ok, LSocket} = ?LISTEN(Config, 0, [{ip, Addr}, {active, false}]), {ok, {_, PortNum}} = inet:sockname(LSocket), ?P("Listening on ~w with port number ~p", [LSocket, PortNum]), -- 2.35.3
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor