wasm-micro-runtime/core/iwasm
Callum Macmillan 8dd1c8ab86
Copy only received bytes from socket recv buffer into the app buffer (#1497)
**What**

* Updated `copy_buffer_to_iovec_app` so that it copies as much of the buffer into the iovec as specified
* Throw invalid value when allocating an iovec of size 0

**Why**

* A bug found from TCP client example which allocates 1024 for the iovec size (where the buf size is also 1024) but received bytes is passed in as the `buf_size` argument to `copy_buffer_to_iovec_app`. This would return early after hitting this check `buf + data->buf_len > buf_begin + buf_size`. However, if the amount to copy is less than the iovec size, we should copy that much of the buf size. Eg TCP client sample receives 27(?) bytes at a time, and this copies 27 bytes into the iovec of size 1024
* The TCP client example attempts to recv bytes of size 0, this attempts to wasm malloc size 0, which outputs a warning. We should early return if recv bytes of size 0
2022-09-21 06:11:03 +08:00
..
aot Merge main into dev/socket 2022-09-10 22:12:43 +08:00
common Merge main into dev/socket 2022-09-10 22:12:43 +08:00
compilation Fix typo in simd_conversions.c (#1428) 2022-08-29 18:01:19 +08:00
fast-jit Add more checks for Fast JIT gen insn and jit_lock_reg_in_insn (#1449) 2022-09-07 16:52:35 +08:00
include Merge main into dev/socket 2022-09-10 22:12:43 +08:00
interpreter Merge main into dev/socket 2022-09-10 22:12:43 +08:00
libraries Copy only received bytes from socket recv buffer into the app buffer (#1497) 2022-09-21 06:11:03 +08:00
README.md Enable AoT and wamr-sdk, and change arguments of call wasm API (#157) 2020-01-21 13:26:14 +08:00