File 0985-erts-Fix-SEGV-while-printing-timer-to-crash-dump.patch of Package erlang
From e68836452efd1a281cd5ae0bb523a1fe9de9e409 Mon Sep 17 00:00:00 2001
From: Sverker Eriksson <sverker@erlang.org>
Date: Wed, 22 Apr 2020 23:07:15 +0200
Subject: [PATCH] erts: Fix SEGV while printing timer to crash dump
if the timer is not ACTIVE, in which case the 'message' may have
been deallocated.
---
erts/emulator/beam/erl_hl_timer.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/erts/emulator/beam/erl_hl_timer.c b/erts/emulator/beam/erl_hl_timer.c
index b0eb0e85c0..aec31080d2 100644
--- a/erts/emulator/beam/erl_hl_timer.c
+++ b/erts/emulator/beam/erl_hl_timer.c
@@ -2819,6 +2819,10 @@ btm_tree_print(ErtsBifTimer *tmr, void *vbtmp, Sint reds)
{
int is_hlt = !!(tmr->type.head.roflgs & ERTS_TMR_ROFLG_HLT);
ErtsMonotonicTime tpos;
+
+ if (erts_atomic32_read_nob(&tmr->btm.state) != ERTS_TMR_STATE_ACTIVE)
+ return;
+
if (is_hlt)
tpos = 0;
else
--
2.16.4