wasi_nn_openvino.c: add a missing buffer overflow check in get_output (#4353)

cf. https://github.com/bytecodealliance/wasm-micro-runtime/issues/4351
This commit is contained in:
YAMAMOTO Takashi 2025-06-17 12:17:00 +09:00 committed by GitHub
parent 20be1d33fe
commit 2f0750a6fe
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -439,6 +439,11 @@ get_output(void *ctx, graph_execution_context exec_ctx, uint32_t index,
CHECK_OV_STATUS(ov_tensor_get_byte_size(ov_tensor, &byte_size), ret); CHECK_OV_STATUS(ov_tensor_get_byte_size(ov_tensor, &byte_size), ret);
if (byte_size > *output_tensor_size) {
ret = too_large;
goto fail;
}
CHECK_OV_STATUS(ov_tensor_data(ov_tensor, &data), ret); CHECK_OV_STATUS(ov_tensor_data(ov_tensor, &data), ret);
memcpy(output_tensor, data, byte_size); memcpy(output_tensor, data, byte_size);