netliomax25-code opened PR #14884 from netliomax25-code:wasi-nn-witx-guest-error-trap to bytecodealliance:main:
The WITX wasi-nn host panics when a guest passes a bad pointer or a non-UTF-8 string, because
nn_errno_from_wasi_nn_errorhitsunimplemented!()forWasiNnError::GuestError. For example,load_by_namewith a name pointer past the end of linear memory takes down the host with "not implemented: guest error conversion" instead of failing the call.This returns the
GuestErroras a trap. Invalid enum arguments already trap in the wiggle glue, and WASIp1 traps on out-of-bounds pointers, so this follows the same model. The new unit test callsload_by_namewith an out-of-bounds pointer and with invalid UTF-8; it panics before this change and passes after.Tested with
cargo test -p wasmtime-wasi-nn --lib, with and without default features.
netliomax25-code removed the review request for wasmtime-wasi-reviewers from PR #14884.
netliomax25-code requested rvolosatovs for a review on PR #14884.
netliomax25-code requested wasmtime-wasi-reviewers for a review on PR #14884.
alexcrichton commented on PR #14884:
cc @rahulchaphalkar @jlb6740
alexcrichton added the label wasi-nn on PR #14884.
alexcrichton removed the review request for rvolosatovs from PR #14884.
:thumbs_up: rahulchaphalkar submitted PR review:
LGTM, thanks!
:thumbs_up: alexcrichton submitted PR review.
alexcrichton added PR #14884 wasi-nn: trap instead of panicking on guest memory errors to the merge queue.
:check: alexcrichton merged PR #14884.
alexcrichton removed PR #14884 wasi-nn: trap instead of panicking on guest memory errors from the merge queue.
Last updated: Oct 31 2026 at 23:03 UTC