Enum png::decoder::stream::FormatErrorInner
source · pub(crate) enum FormatErrorInner {
Show 34 variants
CrcMismatch {
crc_val: u32,
crc_sum: u32,
chunk: ChunkType,
},
InvalidSignature,
MissingFctl,
MissingImageData,
ChunkBeforeIhdr {
kind: ChunkType,
},
AfterIdat {
kind: ChunkType,
},
BeforePlte {
kind: ChunkType,
},
AfterPlte {
kind: ChunkType,
},
OutsidePlteIdat {
kind: ChunkType,
},
DuplicateChunk {
kind: ChunkType,
},
ApngOrder {
present: u32,
expected: u32,
},
ShortPalette {
expected: usize,
len: usize,
},
InvalidSbitChunkSize {
color_type: ColorType,
expected: usize,
len: usize,
},
InvalidSbit {
sample_depth: BitDepth,
sbit: u8,
},
PaletteRequired,
InvalidColorBitDepth {
color_type: ColorType,
bit_depth: BitDepth,
},
ColorWithBadTrns(ColorType),
InvalidDimensions,
InvalidBitDepth(u8),
InvalidColorType(u8),
InvalidDisposeOp(u8),
InvalidBlendOp(u8),
InvalidUnit(u8),
InvalidSrgbRenderingIntent(u8),
UnknownCompressionMethod(u8),
UnknownFilterMethod(u8),
UnknownInterlaceMethod(u8),
BadSubFrameBounds {},
CorruptFlateStream {
err: DecompressionError,
},
NoMoreImageData,
BadTextEncoding(TextDecodingError),
FdatShorterThanFourBytes,
UnexpectedRestartOfDataChunkSequence {
kind: ChunkType,
},
ChunkTooShort {
kind: ChunkType,
},
}
Variants§
CrcMismatch
Bad framing.
Fields
InvalidSignature
Not a PNG, the magic signature is missing.
MissingFctl
Fctl must occur if an animated chunk occurs.
MissingImageData
Image data that was indicated in IHDR or acTL is missing.
ChunkBeforeIhdr
4.3., Must be first.
AfterIdat
4.3., some chunks must be before IDAT.
BeforePlte
AfterPlte
4.3., some chunks must be before PLTE.
OutsidePlteIdat
4.3., some chunks must be between PLTE and IDAT.
DuplicateChunk
4.3., some chunks must be unique.
ApngOrder
Specifically for fdat there is an embedded sequence number for chunks.
Fields
ShortPalette
The palette did not even contain a single pixel data.
InvalidSbitChunkSize
sBIT chunk size based on color type.
InvalidSbit
PaletteRequired
A palletized image did not have a palette.
InvalidColorBitDepth
The color-depth combination is not valid according to Table 11.1.
ColorWithBadTrns(ColorType)
InvalidDimensions
The image width or height is zero.
InvalidBitDepth(u8)
InvalidColorType(u8)
InvalidDisposeOp(u8)
InvalidBlendOp(u8)
InvalidUnit(u8)
InvalidSrgbRenderingIntent(u8)
The rendering intent of the sRGB chunk is invalid.
UnknownCompressionMethod(u8)
UnknownFilterMethod(u8)
UnknownInterlaceMethod(u8)
BadSubFrameBounds
The subframe is not in bounds of the image. TODO: fields with relevant data.
CorruptFlateStream
The compression of the data stream was faulty.
Fields
err: DecompressionError
NoMoreImageData
The image data chunk was too short for the expected pixel count.
BadTextEncoding(TextDecodingError)
Bad text encoding
FdatShorterThanFourBytes
fdAT shorter than 4 bytes
UnexpectedRestartOfDataChunkSequence
“11.2.4 IDAT Image data” section of the PNG spec says: There may be multiple IDAT chunks;
if so, they shall appear consecutively with no other intervening chunks.
UnexpectedRestartOfDataChunkSequence{kind: IDAT}
indicates that there were “intervening
chunks”.
The APNG spec doesn’t directly describe an error similar to CantInterleaveIdatChunks
,
but we require that a new sequence of consecutive fdAT
chunks cannot appear unless we’ve
seen an fcTL
chunk.
ChunkTooShort
Failure to parse a chunk, because the chunk didn’t contain enough bytes.