Skip to content

Commit fa9d989

Browse files
committed
Add an extra assert to internal buffers in futures/streams
This is effectively already implied by the rest of the implementation but by making this a first-class assert it makes it easier to verify the subsequent `unsafe` code is correct.
1 parent 2b8be12 commit fa9d989

File tree

1 file changed

+1
-0
lines changed
  • crates/wasmtime/src/runtime/component/concurrent/futures_and_streams

1 file changed

+1
-0
lines changed

crates/wasmtime/src/runtime/component/concurrent/futures_and_streams/buffers.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,7 @@ pub struct SliceBuffer {
223223

224224
impl SliceBuffer {
225225
pub fn new(buffer: Vec<u8>, offset: usize, limit: usize) -> Self {
226+
assert!(offset <= limit);
226227
assert!(limit <= buffer.len());
227228
Self {
228229
buffer,

0 commit comments

Comments
 (0)