From f42ffe1d9db8f2db7fadc81c68fc4253728995d5 Mon Sep 17 00:00:00 2001 From: Wenyong Huang Date: Thu, 7 Dec 2023 10:26:28 +0800 Subject: [PATCH] Fix sample basic intToStr was called with wrong length (#2876) Reported in https://github.com/bytecodealliance/wasm-micro-runtime/issues/2874. --- RELEASE_NOTES.md | 4 ++++ samples/basic/wasm-apps/testapp.c | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index 9f4d76d7..fbb97f5d 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -70,6 +70,9 @@ - Fix fast-jit accessing shared memory's fields issue (#2841) - Fix wasm loader handle op_br_table and op_drop (#2864) - Fix block with type issue in fast interp (#2866) +- Fix float argument handling for riscv32 ilp32d (#2871) +- Portably handle fd_advise on directory fd (#2875) +- Fix sample basic intToStr was called with wrong length (#2876) ### Enhancements - Implement strict validation of thread IDs according to the specification (#2521) @@ -127,6 +130,7 @@ - Use wasm_config_t to pass private configuration to wasm_engine_new (#2837) - core/iwasm/interpreter/wasm_loader.c: remove an extra validation (#2845) - Don't add "+d" to riscv cpu features if already given (#2855) +- Fix compilation warnings on Windows (#2868) ### Others - Add mutex stress test (#2472) diff --git a/samples/basic/wasm-apps/testapp.c b/samples/basic/wasm-apps/testapp.c index ea575e20..8db29307 100644 --- a/samples/basic/wasm-apps/testapp.c +++ b/samples/basic/wasm-apps/testapp.c @@ -58,7 +58,7 @@ float_to_string(float n, char *res, int res_size, int afterpoint) // is needed to handle cases like 233.007 fpart = fpart * get_pow(10, afterpoint); - intToStr((int)fpart, res + i + 1, sizeof(res + i + 1), afterpoint); + intToStr((int)fpart, res + i + 1, res_size - i - 1, afterpoint); } }