Skip to content

Commit 8f0a3db

Browse files
authored
Add an extra assert to internal buffers in futures/streams (#13103)
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 e10bd43 commit 8f0a3db

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)