Skip to main content

try_read_pod_at

Function try_read_pod_at 

Source
pub fn try_read_pod_at<T>(window: &[u8], offset: usize) -> Result<T>
Expand description

Bounds-checked read of a POD value at offset within window. Replaces read_any(window.as_ptr().add(offset)) on untrusted windows — both offset and size_of::<T>() may originate from untrusted stream metadata, so their sum is validated with checked_add before the window length check.