wasm-micro-runtime/core/iwasm/libraries
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
..
debug-engine Merge main into dev/socket 2022-09-10 22:12:43 +08:00
lib-pthread Implement POSIX semaphore support for linux platform (#1345) 2022-08-08 19:59:46 +08:00
lib-rats Fix a potential memory leak issue in wasm_native_init (#1465) 2022-09-08 14:22:34 +08:00
lib-socket Added http downloader and multicast socket options (#1467) 2022-09-15 17:09:39 +08:00
libc-builtin Remove some unused codes (#1379) 2022-08-15 10:13:37 +08:00
libc-emcc Apply clang-format for core/iwasm compilation and libraries (#784) 2021-10-13 15:13:00 +08:00
libc-uvwasi Fix libc-wasi/uvwasi poll/environ_get issues (#1300) 2022-07-20 20:02:26 +08:00
libc-wasi Copy only received bytes from socket recv buffer into the app buffer (#1497) 2022-09-21 06:11:03 +08:00
thread-mgr wasm_cluster_spread_custom_data: Fix a crash when called before exec (#1257) 2022-06-29 13:21:03 +08:00