diff options
author | Björn-Egil Dahlberg <[email protected]> | 2015-05-23 00:56:21 +0200 |
---|---|---|
committer | Björn-Egil Dahlberg <[email protected]> | 2015-05-25 15:29:49 +0200 |
commit | 528954b7ec9642f9ec987707352d558f9fd41446 (patch) | |
tree | 372a41475c94fc932f5952a87e9e21353fa66734 /erts/emulator/beam/beam_bif_load.c | |
parent | 545890576542e4be630df8772654b99bd0306f62 (diff) | |
download | otp-528954b7ec9642f9ec987707352d558f9fd41446.tar.gz otp-528954b7ec9642f9ec987707352d558f9fd41446.tar.bz2 otp-528954b7ec9642f9ec987707352d558f9fd41446.zip |
erts: Fix garbage collect literals in code purge
During code purging and check_process_code, the checking of the binary reference
embedded in the match binary state was omitted for the tracing tests. This would cause
the binary match state to reference deallocated memory.
Diffstat (limited to 'erts/emulator/beam/beam_bif_load.c')
-rw-r--r-- | erts/emulator/beam/beam_bif_load.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/erts/emulator/beam/beam_bif_load.c b/erts/emulator/beam/beam_bif_load.c index df1983a83d..ef42bb20d3 100644 --- a/erts/emulator/beam/beam_bif_load.c +++ b/erts/emulator/beam/beam_bif_load.c @@ -33,6 +33,7 @@ #include "beam_catches.h" #include "erl_binary.h" #include "erl_nif.h" +#include "erl_bits.h" #include "erl_thr_progress.h" static void set_default_trace_pattern(Eterm module); @@ -940,7 +941,15 @@ any_heap_refs(Eterm* start, Eterm* end, char* mod_start, Uint mod_size) break; case TAG_PRIMARY_HEADER: if (!header_is_transparent(val)) { - Eterm* new_p = p + thing_arityval(val); + Eterm* new_p; + if (header_is_bin_matchstate(val)) { + ErlBinMatchState *ms = (ErlBinMatchState*) p; + ErlBinMatchBuffer *mb = &(ms->mb); + if (in_area(EXPAND_POINTER(mb->orig), mod_start, mod_size)) { + return 1; + } + } + new_p = p + thing_arityval(val); ASSERT(start <= new_p && new_p < end); p = new_p; } |