Skip to content

Commit fbd27e5

Browse files
authored
wasi_nn_llamacpp.c: explicitly reject unimplemented input index (#4446)
note: wasmedge seems to accept index 1 for metadata. we don't implement it.
1 parent d3b0b5c commit fbd27e5

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -407,6 +407,11 @@ set_input(void *ctx, graph_execution_context exec_ctx, uint32_t index,
407407
return runtime_error;
408408
}
409409

410+
if (index != 0) {
411+
NN_ERR_PRINTF("Invalid input index %d", index);
412+
return invalid_argument;
413+
}
414+
410415
// tensor->data is the prompt string.
411416
char *prompt_text = (char *)wasi_nn_tensor->data.buf;
412417
uint32_t prompt_text_len = wasi_nn_tensor->data.size;

0 commit comments

Comments
 (0)