Skip to main content

verify_record

Function verify_record 

Source
pub fn verify_record(
    bytes: &[u8],
    layout: &OffsetTable,
    fields: &[Field],
    record_base: usize,
    region: Region,
) -> Result<(), VerifyError>
Expand description

Verify that every offset reachable from a record laid out by layout / fields — anchored at record_base — stays inside region for the byte slice bytes.

This is the entry point a host calls before decoding a return value: pass the return layout, the return schema’s fields, the buffer-base offset of the root record (out_ptr-relative 0 for a top-level return), and the out_buf region. A clean Ok(()) certifies that a subsequent crate::buffer::BufferReader walk will not dereference out of region.

bytes must cover at least region.end bytes; otherwise the region bounds are themselves unsatisfiable and VerifyError::BufferShorterThanRegion is returned.