From 9a5572a69cb146df5848f7457a4545c1968a9f40 Mon Sep 17 00:00:00 2001 From: Puelloc Date: Sat, 14 Jan 2023 07:38:34 +0000 Subject: [PATCH] fix: freaddir_sync will lost last entry --- .github/workflows/examples.yml | 6 +++--- src/internal_module/fs.rs | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml index c579d28..7f1148e 100644 --- a/.github/workflows/examples.yml +++ b/.github/workflows/examples.yml @@ -32,9 +32,9 @@ jobs: - name: Install WasmEdge run: | - VERSION=0.10.0 - curl -sSf https://raw.githubusercontent.com/WasmEdge/WasmEdge/master/utils/install.sh | sudo bash -s -- -e all --version=$VERSION --tf-version=$VERSION --tf-deps-version=$VERSION --tf-tools-version=$VERSION --image-version=$VERSION --image-deps-version=$VERSION -p /usr/local - + VERSION=0.11.2 + curl -sSf https://raw.githubusercontent.com/WasmEdge/WasmEdge/master/utils/install.sh | sudo bash -s -- -e all --version=$VERSION --tf-version=$VERSION --tf-deps-version=$VERSION --tf-tools-version=$VERSION --image-version=$VERSION -p /usr/local + - uses: actions/setup-node@v2 with: node-version: '14' diff --git a/src/internal_module/fs.rs b/src/internal_module/fs.rs index 6d1d0e1..83f2a6c 100644 --- a/src/internal_module/fs.rs +++ b/src/internal_module/fs.rs @@ -853,7 +853,7 @@ fn freaddir_sync(ctx: &mut Context, _this_val: JsValue, arg: &[JsValue]) -> JsVa *(&buf[idx..(idx + s)] as *const [u8] as *const wasi_fs::Dirent) }; idx += s; - if (idx + dir.d_namlen as usize) >= len.min(4096) { + if (idx + dir.d_namlen as usize) > len.min(4096) { break; } let name =