[erlang-questions] Base64 decode binaries with ets bug?
Sverker Eriksson
sverker.eriksson@REDACTED
Tue Aug 14 14:41:32 CEST 2012
Thanks for reporting, Valentino.
It is indeed an ETS bug that can corrupt binaries in compressed tables.
Below is a patch scheduled for R15B02.
diff --git a/erts/emulator/beam/external.c b/erts/emulator/beam/external.c
index 4348578..52f45b9 100644
--- a/erts/emulator/beam/external.c
+++ b/erts/emulator/beam/external.c
@@ -1889,7 +1889,9 @@ enc_term(ErtsAtomCacheMap *acmp, Eterm obj, byte*
ep, Uint32 dflags,
*ep++ = BINARY_INTERNAL_REF;
}
if (pb->flags) {
+ char* before_realloc = pb->val->orig_bytes;
erts_emasculate_writable_binary(pb);
+ bytes += (pb->val->orig_bytes - before_realloc);
}
erts_refc_inc(&pb->val->refc, 2);
/Sverker, Erlang/OTP
More information about the erlang-questions
mailing list