v3.4.2
Fixed
- Streaming PNG parsing for files with non-trivial IDAT — every
real-world PNG (i.e. anything beyond a stripped-down test fixture)
surfacedmalformed iso-bmff box: PNG: bad signaturefrom
parse_exif/parse_image_metadata. Root cause was a two-part
bug in the chunk walker: (a)ClearAndSkip(total - remaining)
under-requested the skip distance by exactlycursor + remaining
bytes — semantically the caller should advance the parser's
logical position bycursor + total, not just past the buffer's
end — leaving the parser stranded mid-IDAT; (b) on the resumed call
extract_chunksalways re-validatedbuf[..8]against the PNG
signature, but the resumed buffer started mid-stream and the check
failed. Fixed both: skip request is nowcursor + total, and a new
ParsingState::PngPastSignaturetells the resumed call to skip the
signature check. In-memory mode (from_memory) was unaffected
because the full file is buffered at once andClearAndSkipnever
fires. Fixes #55.
Fixed (behaviour)
Error::Malformed.kindcorrectly identifies the failing
structural unit. Previously every parse failure that flowed
throughFrom<ParsedError> for Erroror
From<nom::Err<...>> for Errorwas hard-coded as
MalformedKind::IsoBmffBox/MalformedKind::TiffHeader
respectively — misleading for PNG / JPEG / EBML inputs. The
MalformedKindis now threaded throughParsingError::Failed,
ParsedError::Failed, andLoopAction::Failed, and surfaced
unchanged at theErrorboundary. Downstream code that
(incorrectly) matched onkind == IsoBmffBoxto catch any
parse failure will need updating; conformant code that uses a
_ =>arm (required by#[non_exhaustive]) is unaffected.
Added
MalformedKind::PngChunkvariant.MalformedKindis
#[non_exhaustive], so adding a variant is non-breaking.
Full changelog: CHANGELOG.md · crates.io: nom-exif 3.4.2