aboutsummaryrefslogtreecommitdiffstats
path: root/erts
diff options
context:
space:
mode:
authorLukas Larsson <[email protected]>2017-02-27 10:11:47 +0100
committerLukas Larsson <[email protected]>2017-02-27 10:11:47 +0100
commitcfe4b5c4aaa0d86f9d98095515ae6582a053cc47 (patch)
tree6018097e733dda4b972af88765431cd8cc952477 /erts
parent3671dd2d426208cf0639530b294da083b5e75acd (diff)
downloadotp-cfe4b5c4aaa0d86f9d98095515ae6582a053cc47.tar.gz
otp-cfe4b5c4aaa0d86f9d98095515ae6582a053cc47.tar.bz2
otp-cfe4b5c4aaa0d86f9d98095515ae6582a053cc47.zip
erts: Fix emasculation of binaries in port_control
This fixes a bug introduced in 3671dd2d
Diffstat (limited to 'erts')
-rw-r--r--erts/emulator/beam/io.c10
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