aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLukas Larsson <[email protected]>2017-03-01 10:36:55 +0100
committerLukas Larsson <[email protected]>2017-03-01 10:36:55 +0100
commite91f1fc6f07dfe99b73661e8d431a51f6f996b0f (patch)
tree195873956ad55dbf20b67e9d041c7ac9dda94422
parentc1ea854fac3d8ed144c7fcc909a4671331e43c16 (diff)
parent55f203d6af5cebee168814a8f57f4b2273fa2878 (diff)
downloadotp-e91f1fc6f07dfe99b73661e8d431a51f6f996b0f.tar.gz
otp-e91f1fc6f07dfe99b73661e8d431a51f6f996b0f.tar.bz2
otp-e91f1fc6f07dfe99b73661e8d431a51f6f996b0f.zip
Merge branch 'maint'
-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 ebff564421..ddff862607 100644
--- a/erts/emulator/beam/io.c
+++ b/erts/emulator/beam/io.c
@@ -4887,10 +4887,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