File 1109-erts-Fix-valgrind-uninitialized-data-warning-in-re-i.patch of Package erlang
From def757fa10f6d2ecd315f6ab3ccfa1cb27756a49 Mon Sep 17 00:00:00 2001
From: Sverker Eriksson <sverker@erlang.org>
Date: Mon, 1 Feb 2021 17:21:24 +0100
Subject: [PATCH] erts: Fix valgrind uninitialized data warning in re:inspect
triggered by re_SUITE:error_info (some times).
Make sure binary is at least 4 bytes long
so we can read incorrect magic_number and bail out.
---
erts/emulator/beam/erl_bif_re.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/erts/emulator/beam/erl_bif_re.c b/erts/emulator/beam/erl_bif_re.c
index 568534cab2..0428b4e348 100644
--- a/erts/emulator/beam/erl_bif_re.c
+++ b/erts/emulator/beam/erl_bif_re.c
@@ -1502,7 +1502,7 @@ re_inspect_2(BIF_ALIST_2)
tp = tuple_val(BIF_ARG_1);
if (tp[1] != am_re_pattern || is_not_small(tp[2]) ||
is_not_small(tp[3]) || is_not_small(tp[4]) ||
- is_not_binary(tp[5])) {
+ is_not_binary(tp[5]) || binary_size(tp[5]) < 4) {
goto error;
}
if (BIF_ARG_2 != am_namelist) {
--
2.26.2