From c9765df137370b692cd9476ff5a4d00122b2ba93 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Gustavsson?= Date: Wed, 25 Oct 2017 10:39:29 +0200 Subject: erl_process_dump: Don't assume that literals can be found Native code does not register its literals in the code header for the loaded code. Therefore, a literal created by native code can not be found by mark_literal(). Ignore literals that can't be found instead of crashing (the crasdump_viewer will report such literals as incomplete heap data, but will not crash). --- erts/emulator/beam/erl_process_dump.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'erts/emulator/beam') diff --git a/erts/emulator/beam/erl_process_dump.c b/erts/emulator/beam/erl_process_dump.c index 9fd024cae8..5641195458 100644 --- a/erts/emulator/beam/erl_process_dump.c +++ b/erts/emulator/beam/erl_process_dump.c @@ -728,8 +728,15 @@ static void mark_literal(Eterm* ptr) ap = bsearch(ptr, lit_areas, num_lit_areas, sizeof(ErtsLiteralArea*), search_areas); - ASSERT(ap); - ap[0]->off_heap = (struct erl_off_heap_header *) 1; + + /* + * If the literal was created by native code, this search will not + * find it and ap will be NULL. + */ + + if (ap) { + ap[0]->off_heap = (struct erl_off_heap_header *) 1; + } } -- cgit v1.2.3