diff options
author | Sverker Eriksson <sverker@erlang.org> | 2021-02-01 17:21:24 +0100 |
---|---|---|
committer | Sverker Eriksson <sverker@erlang.org> | 2021-02-01 17:22:51 +0100 |
commit | def757fa10f6d2ecd315f6ab3ccfa1cb27756a49 (patch) | |
tree | 7622b255d2e7d05e0e16391543e2159bbe176029 | |
parent | 081245662af5b8757540ddf93342734619280c27 (diff) | |
download | erlang-def757fa10f6d2ecd315f6ab3ccfa1cb27756a49.tar.gz |
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.
-rw-r--r-- | erts/emulator/beam/erl_bif_re.c | 2 |
1 files changed, 1 insertions, 1 deletions
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) { |