diff options
author | Rickard Green <[email protected]> | 2019-03-28 19:59:58 +0100 |
---|---|---|
committer | Rickard Green <[email protected]> | 2019-04-05 14:50:27 +0200 |
commit | f2671c2ef47f8c49cd5fab6e1737ed08d99ea5d2 (patch) | |
tree | aa69869ff75dadbcdf8c3432ec370c7af409d844 /erts/emulator/beam/io.c | |
parent | 060d9110ffb305d6ce5f974788948463e481203b (diff) | |
download | otp-f2671c2ef47f8c49cd5fab6e1737ed08d99ea5d2.tar.gz otp-f2671c2ef47f8c49cd5fab6e1737ed08d99ea5d2.tar.bz2 otp-f2671c2ef47f8c49cd5fab6e1737ed08d99ea5d2.zip |
Fail when we cannot encode term in binary
Fail when we cannot encode term in binary instead of producing a
faulty result.
Diffstat (limited to 'erts/emulator/beam/io.c')
-rw-r--r-- | erts/emulator/beam/io.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/erts/emulator/beam/io.c b/erts/emulator/beam/io.c index b961c639f5..31c941337f 100644 --- a/erts/emulator/beam/io.c +++ b/erts/emulator/beam/io.c @@ -4450,6 +4450,7 @@ erts_port_call(Process* c_p, char input_buf[256]; char *bufp; byte *endp; + Uint uintsz; ErlDrvSizeT size; int try_call; erts_aint32_t sched_flags; @@ -4462,7 +4463,9 @@ erts_port_call(Process* c_p, try_call = !(sched_flags & ERTS_PTS_FLGS_FORCE_SCHEDULE_OP); - size = erts_encode_ext_size(data); + if (erts_encode_ext_size(data, &uintsz) != ERTS_EXT_SZ_OK) + return ERTS_PORT_OP_BADARG; + size = (ErlDrvSizeT) uintsz; if (!try_call) bufp = erts_alloc(ERTS_ALC_T_DRV_CALL_DATA, size); |