wasm-micro-runtime/samples
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
..
basic Enhance cmake makefiles (#1390) 2022-08-18 16:27:01 +08:00
gui Enhance cmake makefiles (#1390) 2022-08-18 16:27:01 +08:00
littlevgl Enhance cmake makefiles (#1390) 2022-08-18 16:27:01 +08:00
multi-module Fix multi-module and some other issues (#1435) 2022-08-31 17:38:38 +08:00
multi-thread Fix issue in multi-thread sample (#1458) 2022-09-07 12:56:50 +08:00
native-lib Make robust on choosing target assumption for X86_32 support (#1241) 2022-06-27 20:30:31 +08:00
ref-types Enhance cmake makefiles (#1390) 2022-08-18 16:27:01 +08:00
sgx-ra Enable remote attestation by librats in SGX mode (#1445) 2022-09-06 14:29:58 +08:00
simple Enhance cmake makefiles (#1390) 2022-08-18 16:27:01 +08:00
socket-api Copy only received bytes from socket recv buffer into the app buffer (#1497) 2022-09-21 06:11:03 +08:00
spawn-thread Make robust on choosing target assumption for X86_32 support (#1241) 2022-06-27 20:30:31 +08:00
wasm-c-api Enhance cmake makefiles (#1390) 2022-08-18 16:27:01 +08:00
workload Fix build issue of the meshoptimizer workload (#1452) 2022-09-05 21:56:23 +08:00