Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Treat
UnexpectedEof
under parse_chunk
as a FormatError
.
Fuzzing found a broken PNG file where an `fcTL` chunk is too short, and where `read_be` or `read_exact` in `parse_fctl` returns `UnexpectedEof`. This file was saved under `fuzz/corpus/buf_independent/regressions`. Before this commit, the input above would mislead the client/fuzzer code into thinking that there is a recoverable error that may go away after more PNG bytes are available. (This was incorrect because `parse_chunk` and `parse_fctl` are only called after gathering *all* the bytes of a chunk into `ChunkState::raw_bytes`.) But when the client tried resuming, we got into an infinite loop because `StreamingDecoder` has already given up and set `state` to `None`. After this commit, the timeout is avoided by properly indicating a non-recoverable error in such a situation.
- Loading branch information