From 08efc8867e9e74864890d1d4db465d17acd6b5e2 Mon Sep 17 00:00:00 2001 From: Sverker Eriksson Date: Mon, 25 May 2020 21:09:39 +0200 Subject: erts: Fix bug in encoding of export fun on pending connection A hopefull export fun adds 2 to vlen (not 1), terminating the previous entry plus the hopefull entry itself. --- erts/emulator/beam/external.c | 4 ++-- erts/emulator/test/distribution_SUITE.erl | 10 +++++++++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/erts/emulator/beam/external.c b/erts/emulator/beam/external.c index 6981e14fa8..1a29904f5e 100644 --- a/erts/emulator/beam/external.c +++ b/erts/emulator/beam/external.c @@ -5311,8 +5311,8 @@ encode_size_struct_int(TTBSizeContext* ctx, ErtsAtomCacheMap *acmp, Eterm obj, ASSERT(dflags & DFLAG_EXPORT_PTR_TAG); csz = tmp_result - ctx->last_result; /* potentially multiple elements leading up to hopefull entry */ - vlen += csz/MAX_SYSIOVEC_IOVLEN; - vlen++; /* hopefull entry */ + vlen += (csz/MAX_SYSIOVEC_IOVLEN + 1 + + 1); /* hopefull entry */ result += 4; /* hopefull index */ ctx->last_result = result; } diff --git a/erts/emulator/test/distribution_SUITE.erl b/erts/emulator/test/distribution_SUITE.erl index 65b580f12c..52df62d057 100644 --- a/erts/emulator/test/distribution_SUITE.erl +++ b/erts/emulator/test/distribution_SUITE.erl @@ -74,6 +74,7 @@ message_latency_large_exit2/0, system_limit/1, hopefull_data_encoding/1, + hopefull_export_fun_bug/1, mk_hopefull_data/0]). %% Internal exports. @@ -104,7 +105,7 @@ all() -> {group, message_latency}, {group, bad_dist}, {group, bad_dist_ext}, start_epmd_false, epmd_module, system_limit, - hopefull_data_encoding]. + hopefull_data_encoding, hopefull_export_fun_bug]. groups() -> [{bulk_send, [], [bulk_send_small, bulk_send_big, bulk_send_bigbig]}, @@ -2711,6 +2712,13 @@ chk_hopefull_fallback(Other, SameOther) -> Other = SameOther, ok. +%% ERL-1254 +hopefull_export_fun_bug(Config) when is_list(Config) -> + Msg = [1, fun blipp:blapp/7, + 2, fun blipp:blapp/7], + {dummy, dummy@dummy} ! Msg. % Would crash on debug VM + + %%% Utilities timestamp() -> -- cgit v1.2.1