File 0357-erl_bif_binary.c-Eliminate-use-of-uninitialized-vari.patch of Package erlang

From dd72d8bad8c40ec0878005d2ce5dc5add522fc8f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bj=C3=B6rn=20Gustavsson?= <bjorn@erlang.org>
Date: Thu, 28 Jan 2021 07:56:57 +0100
Subject: [PATCH 1/4] erl_bif_binary.c: Eliminate use of uninitialized variable
 in debug build

---
 erts/emulator/beam/erl_bif_binary.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/erts/emulator/beam/erl_bif_binary.c b/erts/emulator/beam/erl_bif_binary.c
index dbc606505e..a1a728f09e 100644
--- a/erts/emulator/beam/erl_bif_binary.c
+++ b/erts/emulator/beam/erl_bif_binary.c
@@ -1913,7 +1913,7 @@ static Eterm do_split_global_result(Process *p, Eterm subject, BinaryFindContext
 static BIF_RETTYPE binary_find_trap(BIF_ALIST_3)
 {
     int runres;
-    Eterm result;
+    Eterm result = THE_NON_VALUE; /* Used in debug build. */
     Binary *ctx_bin = erts_magic_ref2bin(BIF_ARG_2);
     Binary *pat_bin = erts_magic_ref2bin(BIF_ARG_3);
     BinaryFindContext *ctx = NULL;
@@ -1921,10 +1921,10 @@ static BIF_RETTYPE binary_find_trap(BIF_ALIST_3)
     ASSERT(ERTS_MAGIC_BIN_DESTRUCTOR(ctx_bin) == bf_context_destructor);
     runres = do_binary_find(BIF_P, BIF_ARG_1, &ctx, pat_bin, ctx_bin, &result);
     if (runres == BF_OK) {
-	ASSERT(result != THE_NON_VALUE);
+	ASSERT(is_value(result));
 	BIF_RET(result);
     } else {
-	ASSERT(result == THE_NON_VALUE && ctx->trap_term != result && ctx->pat_term != result);
+	ASSERT(is_non_value(result) && ctx->trap_term != result && ctx->pat_term != result);
 	BIF_TRAP3(&binary_find_trap_export, BIF_P, BIF_ARG_1, BIF_ARG_2, BIF_ARG_3);
     }
 }
-- 
2.26.2

openSUSE Build Service is sponsored by