From 933f8124b003d23ad2cb4054c7d376f9bb8bd7b1 Mon Sep 17 00:00:00 2001 From: YAMAMOTO Takashi Date: Fri, 6 Jun 2025 16:08:18 +0900 Subject: [PATCH] wasi-nn: fix the size of tensor->type (#4333) * this enum is (@witx tag u8) in witx * it seems that some wasm modules actually use non-zero padding and cause errors * it's a bad practice to use C enum for ABI description anyway --- core/iwasm/libraries/wasi-nn/include/wasi_nn_types.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/core/iwasm/libraries/wasi-nn/include/wasi_nn_types.h b/core/iwasm/libraries/wasi-nn/include/wasi_nn_types.h index 7e25428fc..0d62ce80d 100644 --- a/core/iwasm/libraries/wasi-nn/include/wasi_nn_types.h +++ b/core/iwasm/libraries/wasi-nn/include/wasi_nn_types.h @@ -79,7 +79,8 @@ typedef struct { // dimensions. tensor_dimensions *dimensions; // Describe the type of element in the tensor (e.g., f32). - tensor_type type; + uint8_t type; + uint8_t _pad[3]; // Contains the tensor data. tensor_data data; } tensor;