diff options
author | Lukas Larsson <[email protected]> | 2017-03-01 10:36:39 +0100 |
---|---|---|
committer | Lukas Larsson <[email protected]> | 2017-03-01 10:36:39 +0100 |
commit | 55f203d6af5cebee168814a8f57f4b2273fa2878 (patch) | |
tree | bd067c71fae1e762b536bd1a570389b1498522da /erts | |
parent | 52f822ab407be031a0013f47ff2b1b45b27fc1f5 (diff) | |
parent | cfe4b5c4aaa0d86f9d98095515ae6582a053cc47 (diff) | |
download | otp-55f203d6af5cebee168814a8f57f4b2273fa2878.tar.gz otp-55f203d6af5cebee168814a8f57f4b2273fa2878.tar.bz2 otp-55f203d6af5cebee168814a8f57f4b2273fa2878.zip |
Merge branch 'lukas/erts/port_control_emasculate_binary/OTP-14231' into maint
* lukas/erts/port_control_emasculate_binary/OTP-14231:
erts: Fix emasculation of binaries in port_control
Diffstat (limited to 'erts')
-rw-r--r-- | erts/emulator/beam/io.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/erts/emulator/beam/io.c b/erts/emulator/beam/io.c index 9bf29ee230..38e403d91a 100644 --- a/erts/emulator/beam/io.c +++ b/erts/emulator/beam/io.c @@ -4889,10 +4889,18 @@ erts_port_control(Process* c_p, copy = 1; else { ProcBin *pb = (ProcBin *) ebinp; + int offset = bufp - pb->val->orig_bytes; - if (pb->flags) + ASSERT(pb->val->orig_bytes <= bufp + && bufp + size <= pb->val->orig_bytes + pb->val->orig_size); + + if (pb->flags) { erts_emasculate_writable_binary(pb); + /* The procbin may have been reallocated, so update bufp */ + bufp = pb->val->orig_bytes + offset; + } + binp = pb->val; ASSERT(bufp <= bufp + size); ASSERT(binp->orig_bytes <= bufp |