diff options
author | John Högberg <john@erlang.org> | 2018-02-19 18:04:01 +0100 |
---|---|---|
committer | John Högberg <john@erlang.org> | 2018-02-26 08:29:38 +0100 |
commit | 89de89e4c962aac2ff0c55f420ef6d510533f02a (patch) | |
tree | 1bfa9c75a66b87a35b471fbf6ab0c47c37cc0e50 /erts/emulator/beam/erl_nif.h | |
parent | 97ac7f37c93b36617fe09b81f64a967b0d341673 (diff) | |
download | otp-89de89e4c962aac2ff0c55f420ef6d510533f02a.tar.gz otp-89de89e4c962aac2ff0c55f420ef6d510533f02a.tar.bz2 otp-89de89e4c962aac2ff0c55f420ef6d510533f02a.zip |
Unconditionally transfer ownership to the created term
This fixes two corner-cases:
1) We will no longer return an invalid term when a binary inspected
on environment A is used in enif_make_binary on environment B
2) A double-free in this sequence of events:
* enif_alloc_binary(size, &bin);
* enif_ioq_enq_binary(ioq, &bin, skip);
* enif_make_binary(env, &bin);
* enif_make_binary(env, &bin);
OTP-14931
OTP-14932
Diffstat (limited to 'erts/emulator/beam/erl_nif.h')
-rw-r--r-- | erts/emulator/beam/erl_nif.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/erts/emulator/beam/erl_nif.h b/erts/emulator/beam/erl_nif.h index 053f7673c4..eb69a8255c 100644 --- a/erts/emulator/beam/erl_nif.h +++ b/erts/emulator/beam/erl_nif.h @@ -137,8 +137,9 @@ typedef struct unsigned char* data; /* Internals (avert your eyes) */ - ERL_NIF_TERM bin_term; void* ref_bin; + /* for future additions to be ABI compatible (same struct size) */ + void* __spare__[1]; }ErlNifBinary; #if (defined(__WIN32__) || defined(_WIN32) || defined(_WIN32_)) |