Skip to main content

load_checkpoint_with_limit

Function load_checkpoint_with_limit 

Source
pub fn load_checkpoint_with_limit<G>(
    path: impl AsRef<Path>,
    max_bytes: u64,
) -> Result<Checkpoint<G>, CheckpointError>
Expand description

Load a checkpoint from a file, rejecting inputs larger than max_bytes.

The limit guards against unbounded allocation from a corrupted or hostile checkpoint (EV-48): both the on-disk file size and every length-prefixed field decoded by bincode are bounded by max_bytes. The embedded schema version is validated for every format, including JSON (EV-45).