demikernel icon indicating copy to clipboard operation
demikernel copied to clipboard

[runtime] Fail When Attempting to `trim()` Too Many Bytes

Open ppenna opened this issue 2 years ago • 0 comments

Description

When one attempts to trim() more bytes than the target buffer has, the runtime panics.

https://github.com/demikernel/runtime/blob/6817e6ecdb7d7117a59f6d315ed419791762fe36/src/memory/buffer/mod.rs#L52-L58

https://github.com/demikernel/runtime/blob/6817e6ecdb7d7117a59f6d315ed419791762fe36/src/memory/buffer/dpdkbuffer.rs#L53-L58

https://github.com/demikernel/runtime/blob/6817e6ecdb7d7117a59f6d315ed419791762fe36/src/memory/buffer/databuffer.rs#L52-L57

Expected Behavior

Instead of panicking, trim() should not modify the underlying buffer and return Err(Fail).

Further References

  • The expected behavior is the same featured by DPDK. For more information refer to: https://doc.dpdk.org/api/rte__mbuf_8h.html#abe1bed439015acec170d1342e8dabb3b.

ppenna avatar Sep 05 '22 13:09 ppenna