#[non_exhaustive]pub enum MalformedError {
Show 45 variants
UnexpectedEof {
offset: u64,
needed: u64,
remaining: u64,
},
InvalidFileSignature,
ReservedFileHeaderFlags(u8),
InvalidBitCount(u8),
ReservedSegmentType(u8),
InvalidReferredToCountCode(u8),
NonCanonicalReferredToCount(u32),
NonZeroUnusedRetentionFlags,
InvalidReferredSegmentNumber {
segment: u32,
referred: u32,
},
InvalidExtensionType(u32),
InvalidCommentExtension,
InvalidProfilesSegment(u32),
InvalidHuffman(HuffmanErrorKind),
InvalidArithmeticContextState {
state_index: u8,
mps: u8,
},
InsufficientArithmeticContexts {
required: usize,
actual: usize,
},
InvalidIaidCodeLength(u8),
InvalidMmr(MmrErrorKind),
InvalidSymbolText(&'static str),
SymbolIdOutOfRange {
id: u32,
available: u32,
},
InvalidSymbolDimensions,
InvalidHalftone(HalftoneErrorKind),
InvalidGenericRegion(GenericRegionErrorKind),
InvalidPageState(&'static str),
InvalidUnknownSegmentLength(u8),
InvalidSegmentDataLength {
segment_type: u8,
expected: u64,
actual: u64,
},
ReservedRegionFlags(u8),
InvalidCombinationOperator(u8),
UnknownHeightWithoutStriping,
InvalidStripeEndRow(u32),
DuplicateSegmentNumber(u32),
NonIncreasingSegmentNumber {
previous: u32,
current: u32,
},
MissingReferredSegment {
segment: u32,
referred: u32,
},
InvalidPageAssociation {
segment: u32,
page: u32,
},
MissingPageInformation(u32),
DuplicatePageBoundary {
page: u32,
segment_type: u8,
},
SegmentAfterEndOfPage {
segment: u32,
page: u32,
},
MissingEndOfPage(u32),
MissingEndOfFile,
TrailingData(u64),
PageCountMismatch {
declared: u32,
actual: u32,
},
InvalidSegmentReferences(u32),
MissingGenericRegionTerminator,
GenericRegionRowCount {
declared: u32,
actual: u32,
},
InvalidRetentionFlags {
segment: u32,
referred: u32,
},
IntegerOverflow,
}Expand description
A deterministic classification of malformed input.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
UnexpectedEof
The input ended before a complete value was available.
Fields
InvalidFileSignature
A standalone file did not start with the JBIG2 identifier.
ReservedFileHeaderFlags(u8)
Reserved file-header flag bits were non-zero.
InvalidBitCount(u8)
A bit read requested more than the supported 32 bits.
ReservedSegmentType(u8)
A reserved segment type appeared in a segment header.
InvalidReferredToCountCode(u8)
The three-bit referred-to count discriminator was reserved.
NonCanonicalReferredToCount(u32)
Long-form referred-to counts were used for four or fewer references.
NonZeroUnusedRetentionFlags
Unused retention bits were non-zero.
InvalidReferredSegmentNumber
A segment referred to itself or a later-numbered segment.
Fields
InvalidExtensionType(u32)
An extension header violates reserved/necessary flag rules.
InvalidCommentExtension
A defined comment extension is not correctly terminated.
InvalidProfilesSegment(u32)
Profiles metadata is misplaced, duplicated, or not restrictive enough.
InvalidHuffman(HuffmanErrorKind)
A Huffman table or coded prefix is malformed.
InvalidArithmeticContextState
A restored arithmetic probability context is invalid.
InsufficientArithmeticContexts
An arithmetic procedure was given too few probability contexts.
InvalidIaidCodeLength(u8)
IAID code length cannot be represented safely.
InvalidMmr(MmrErrorKind)
An MMR mode, run, transition, marker, or padding rule is invalid.
InvalidSymbolText(&'static str)
A symbol dictionary or text-region state-machine rule is invalid.
SymbolIdOutOfRange
A decoded symbol ID does not name an available symbol.
InvalidSymbolDimensions
Refined or collective symbol dimensions are invalid.
InvalidHalftone(HalftoneErrorKind)
A pattern dictionary or halftone rule is invalid.
InvalidGenericRegion(GenericRegionErrorKind)
A generic or refinement region rule is invalid.
InvalidPageState(&'static str)
Decoded segment order or page policy is inconsistent.
InvalidUnknownSegmentLength(u8)
An unknown segment length appeared on a segment type that forbids it.
InvalidSegmentDataLength
A segment payload length did not match its fixed syntax.
Fields
ReservedRegionFlags(u8)
A reserved region information flag was set.
InvalidCombinationOperator(u8)
A region selected an undefined external combination operator.
UnknownHeightWithoutStriping
An unknown-height page was not marked as striped.
InvalidStripeEndRow(u32)
An end-of-stripe row exceeds its page or is not increasing.
DuplicateSegmentNumber(u32)
Segment numbers are duplicated.
NonIncreasingSegmentNumber
Standalone segment headers are not in increasing number order.
MissingReferredSegment
A referred-to segment is absent from the available document state.
InvalidPageAssociation
A segment has an invalid global or page association.
MissingPageInformation(u32)
A page’s first associated segment was not page information.
DuplicatePageBoundary
A page has duplicate page-information or end-of-page segments.
SegmentAfterEndOfPage
A segment associated with a page appeared after its end-of-page segment.
MissingEndOfPage(u32)
A page did not end with an end-of-page segment.
MissingEndOfFile
A random-access file did not contain a final end-of-file header.
TrailingData(u64)
Bytes occurred after a terminal end-of-file segment.
PageCountMismatch
The declared page count differs from parsed pages.
InvalidSegmentReferences(u32)
A fixed-length segment contains semantically invalid reference types.
MissingGenericRegionTerminator
An unknown-length generic region terminator was not found.
GenericRegionRowCount
An unknown-length generic region row count exceeds its declared height.
InvalidRetentionFlags
Retention flags permit discarding a segment before its final use.
Fields
IntegerOverflow
An input-derived arithmetic operation overflowed.