-
Notifications
You must be signed in to change notification settings - Fork 140
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Restore using NoMoreImageData
errors.
#500
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -702,7 +702,9 @@ impl<R: Read> Reader<R> { | |
// Read image data until we have at least one full row (but possibly more than one). | ||
while self.data_stream.len() - self.current_start < rowlen { | ||
if self.subframe.consumed_and_flushed { | ||
return Err(DecodingError::IoError(ErrorKind::UnexpectedEof.into())); | ||
return Err(DecodingError::Format( | ||
FormatErrorInner::NoMoreImageData.into(), | ||
)); | ||
} | ||
|
||
// Clear the current buffer before appending more data. | ||
|
@@ -716,12 +718,9 @@ impl<R: Read> Reader<R> { | |
|
||
match self.decoder.decode_next(&mut self.data_stream)? { | ||
Some(Decoded::ImageData) => {} | ||
Some(Decoded::ImageDataFlushed) => { | ||
Some(Decoded::ImageDataFlushed) | None /* after IEND chunk */ => { | ||
self.subframe.consumed_and_flushed = true; | ||
} | ||
None => { | ||
return Err(DecodingError::IoError(ErrorKind::UnexpectedEof.into())); | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The change above is not associated with a regression test:
Nevertheless, I think this change is still desirable:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In general, if a specific case is impossible we should This crate used to have tons of error handling code for cases that weren't even reachable in the first place, which I've tried to clean up over time. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (edited - my initial markdown attempt didn't work... :-) ) Ack. You're right that my attempt to avoid risk here leads to suboptimal code. Let me try to think through the options available.
I am leaning toward option 2. For now, let me try option #2 locally and double-check that fuzzing doesn't complain. |
||
_ => (), | ||
} | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The change above is needed to avoid a timeout when
cargo fuzz run buf_independent fuzz/corpus/buf_independent/regressions/minimized-from-110a360793767757e44c9e4b95c495666e39e672
is run.