From bf7c722bd3b30e04a56c2d369fd9f5501a8316d0 Mon Sep 17 00:00:00 2001 From: Lukas Larsson Date: Tue, 12 Feb 2019 16:46:33 +0100 Subject: erts: Fix so that externals with creation 0 compare equal to all The special creation of 0 is used by internally created externals, such as when list_to_pid is called. This creation should compare equal to all externals creations of that external. If it does not we can end up in very strange scenarios. For instance: > P = spawn(OtherNode, fun() -> die end). <8303.60.0> > link(<8303.60.0>). true > flush(). ok OTP-15613 --- erts/emulator/beam/utils.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'erts/emulator/beam/utils.c') diff --git a/erts/emulator/beam/utils.c b/erts/emulator/beam/utils.c index 3fa09e39f2..36a492f00d 100644 --- a/erts/emulator/beam/utils.c +++ b/erts/emulator/beam/utils.c @@ -2701,7 +2701,8 @@ Sint erts_cmp_compound(Eterm a, Eterm b, int exact, int eq_only) if((AN)->sysname != (BN)->sysname) \ RETURN_NEQ(erts_cmp_atoms((AN)->sysname, (BN)->sysname)); \ ASSERT((AN)->creation != (BN)->creation); \ - RETURN_NEQ(((AN)->creation < (BN)->creation) ? -1 : 1); \ + if ((AN)->creation != 0 && (BN)->creation != 0) \ + RETURN_NEQ(((AN)->creation < (BN)->creation) ? -1 : 1); \ } \ } while (0) -- cgit v1.2.3