-
-
Notifications
You must be signed in to change notification settings - Fork 852
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
Relaxed handle of corrupt png files #2589
Relaxed handle of corrupt png files #2589
Conversation
@svenclaesson could you please explicitly invite me to contribute to your fork. I need to add the test image from above and due to a quirk in Git LFS permissions with GitHub I cannot push any images to your fork without being invited. @dlemstra is there a way to get the Magick decoder to break on adaptive filter errors? When I try to use your decoder as a reference for this file the following exception is thrown.
|
Thanks for the invite. @svenclaesson I've now reworked the decoder to allow granular control of CRC checking and also allow us to decode the provided image. |
@@ -43,7 +43,7 @@ public void IfAutoLoadWellKnownFormatsIsTrueAllFormatsAreLoaded() | |||
Assert.Equal(1, this.DefaultFormatsManager.ImageDecoders.Select(item => item.Value).OfType<PngDecoder>().Count()); | |||
Assert.Equal(1, this.DefaultFormatsManager.ImageDecoders.Select(item => item.Value).OfType<BmpDecoder>().Count()); | |||
Assert.Equal(1, this.DefaultFormatsManager.ImageDecoders.Select(item => item.Value).OfType<JpegDecoder>().Count()); | |||
Assert.Equal(1, this.DefaultFormatsManager.ImageDecoders.Select(item => item.Value).OfType<BmpDecoder>().Count()); | |||
Assert.Equal(1, this.DefaultFormatsManager.ImageDecoders.Select(item => item.Value).OfType<GifDecoder>().Count()); |
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.
Really good spot!!
Thanks for working on this |
return false; | ||
} | ||
|
||
while (length < 0 || length > (this.currentStream.Length - this.currentStream.Position)) | ||
while (length < 0) |
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.
@antonfirsov I did find a way to improve this!
Prerequisites
Description
WIP support for handing truncated png files
Implementing an option for PngDecoder, IgnoreCrcErrors
Tried it a bit but got stuck by the fact that IDAT and IEND is considered critical chunks and found no way of ignoring that fact if the file is truncated, IDAT is cut off and IEND is missing.
This file is truncated and i'm trying to get a partial result converted as libpng (chrome) and WIC can do.
Maybe you have some pointers for me
See #2570