Skip to content

Commit 2f0750a

Browse files
authored
wasi_nn_openvino.c: add a missing buffer overflow check in get_output (#4353)
cf. #4351
1 parent 20be1d3 commit 2f0750a

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

core/iwasm/libraries/wasi-nn/src/wasi_nn_openvino.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -439,6 +439,11 @@ get_output(void *ctx, graph_execution_context exec_ctx, uint32_t index,
439439

440440
CHECK_OV_STATUS(ov_tensor_get_byte_size(ov_tensor, &byte_size), ret);
441441

442+
if (byte_size > *output_tensor_size) {
443+
ret = too_large;
444+
goto fail;
445+
}
446+
442447
CHECK_OV_STATUS(ov_tensor_data(ov_tensor, &data), ret);
443448

444449
memcpy(output_tensor, data, byte_size);

0 commit comments

Comments
 (0)