demikernel
demikernel copied to clipboard
[runtime] Fail When Attempting to `adjust()` Too Many Bytes
Description
When one attempts to adjust()
more bytes than the target buffer has, the runtime panics.
https://github.com/demikernel/runtime/blob/6817e6ecdb7d7117a59f6d315ed419791762fe36/src/memory/buffer/mod.rs#L43-L49
https://github.com/demikernel/runtime/blob/6817e6ecdb7d7117a59f6d315ed419791762fe36/src/memory/buffer/dpdkbuffer.rs#L45-L50
https://github.com/demikernel/runtime/blob/6817e6ecdb7d7117a59f6d315ed419791762fe36/src/memory/buffer/databuffer.rs#L43-L49
Expected Behavior
Instead of panicking, adjust()
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#a1bbd752194759ce7b419c4998f2e8651.