netliomax25-code opened PR #13819 from netliomax25-code:keyvalue-guard-cursor-delta to bytecodealliance:main:
list_keyscasts the guest-suppliedcursorwithas usizeand slices&keys[cursor..], so a cursor past the number of keys panics the host with an out-of-range slice, and the cast also truncates theu64on 32-bit hosts.incrementcomputescurrent_value + delta, which panics on overflow in debug builds and silently wraps to a smaller value in release, so the returned counter can go backwards.Clamped the cursor to
keys.len()(viatry_from+min) and switchedincrementtochecked_add, returning an error on overflow. Both values come straight from the guest, so the checks live in the callee. Added unit tests that panic on the current code and pass with the fix.
netliomax25-code requested dicej for a review on PR #13819.
netliomax25-code requested wasmtime-wasi-reviewers for a review on PR #13819.
:thumbs_up: dicej submitted PR review:
Thanks!
dicej added PR #13819 guard guest cursor and delta in wasi-keyvalue in-memory store to the merge queue.
:check: dicej merged PR #13819.
dicej removed PR #13819 guard guest cursor and delta in wasi-keyvalue in-memory store from the merge queue.
Last updated: Jul 29 2026 at 05:03 UTC