Skip to main content

Module integrity

Module integrity 

Source
Expand description

Integrity of the sensor payload: structured truncation reports, decode warnings, and the range checks every format runs before it reads sensor bytes.

A strip, tile or other sensor-data range that extends past the end of the file is corruption, and never silent. Under the recover policy (the default, DecodeContext::recover) the decoder uses every complete sample it has, fills the rest with zeros and records a DecodeWarning. Under the strict policy it fails the decode with an Error::CorruptFile whose CorruptReason::Truncated carries the expected range, the bytes actually present and the file length.

Tolerances (data that is short but still complete):

  • Only the bytes the geometry needs are required: the last row needs its samples, not its padding to the full stride, and a declared length beyond that need (end padding) may run past the end of the file.
  • Formats addressed purely by geometry may read past a declared byte count that is too small when the file holds the bytes (some writers understate it).

Structs§

DecodeWarning
Something a decode repaired or substituted instead of failing: under the recover policy (truncated or corrupt units), or with the preview fallback (see CorruptReason::PreviewFallback).
RowGeometry
Geometry of a row-structured payload, used to work out how many bytes are needed and how many samples a truncated range still holds.
SensorBytes
Sensor bytes of one unit, as resolved by DecodeContext::sensor_bytes.
Truncation
A sensor-data range that the file does not fully contain.

Enums§

CorruptReason
Structured cause of an Error::CorruptFile (or of a recovered DecodeWarning).
DataUnit
Which part of the sensor payload a report refers to.

Functions§

check_range
Check that [offset, offset + needed) lies within an input of file_len bytes. Nothing is missing from an empty range, wherever it starts.