diff options
author | Sverker Eriksson <[email protected]> | 2014-09-02 21:16:58 +0200 |
---|---|---|
committer | Sverker Eriksson <[email protected]> | 2014-09-03 11:37:21 +0200 |
commit | 05f748bfdaa4297ae45264ae9297cadb5f33966e (patch) | |
tree | b9fa2e740d4d11ee3a440229ef7095f9528b794d /erts/emulator | |
parent | 56715334380680c1466d2a9165ea2f7affc93a78 (diff) | |
download | otp-05f748bfdaa4297ae45264ae9297cadb5f33966e.tar.gz otp-05f748bfdaa4297ae45264ae9297cadb5f33966e.tar.bz2 otp-05f748bfdaa4297ae45264ae9297cadb5f33966e.zip |
erts: Fix bug in term_to_binary that reallocates binary with wrong size
Diffstat (limited to 'erts/emulator')
-rw-r--r-- | erts/emulator/beam/external.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/erts/emulator/beam/external.c b/erts/emulator/beam/external.c index 8d240355b0..9b9b4b2a62 100644 --- a/erts/emulator/beam/external.c +++ b/erts/emulator/beam/external.c @@ -1925,6 +1925,7 @@ static Eterm erts_term_to_binary_int(Process* p, Eterm Term, int level, Uint fla } real_size = endp - bytes; result_bin = erts_bin_realloc(context->s.ec.result_bin,real_size); + result_bin->orig_size = real_size; level = context->s.ec.level; BUMP_REDS(p, (initial_reds - reds) / TERM_TO_BINARY_LOOP_FACTOR); if (level == 0 || real_size < 6) { /* We are done */ @@ -2004,6 +2005,7 @@ static Eterm erts_term_to_binary_int(Process* p, Eterm Term, int level, Uint fla erl_zlib_deflate_finish(&(context->s.cc.stream)); result_bin = erts_bin_realloc(context->s.cc.destination_bin, context->s.cc.dest_len+6); + result_bin->orig_size = context->s.cc.dest_len+6; context->s.cc.destination_bin = NULL; pb = (ProcBin *) HAlloc(p, PROC_BIN_SIZE); pb->thing_word = HEADER_PROC_BIN; |