Skip to content
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

NoEnabledDecoderFound exception thrown on images #19

Closed
thecaptncode opened this issue Sep 2, 2020 · 8 comments
Closed

NoEnabledDecoderFound exception thrown on images #19

thecaptncode opened this issue Sep 2, 2020 · 8 comments

Comments

@thecaptncode
Copy link

I am using Imageflow.net and trying to get image info on a variety of file types. Most seem to work but several of them are failing with the NoEnabledDecoderFound exception even though they appear to be valid test images.

The packages I have installed are
Imageflow.net v0.7.1
Imageflow.Native.Runtime.win-x86_64 v.1.4.10rc50
and dependencies.

Here is my code. The stream source is a MemoryStream.

ImageInfo info = ImageJob.GetImageInfo(new StreamSource(msDoc, false)).Result;
int width = (int)info.ImageWidth;
int height = (int)info.ImageHeight;
string ext = info.PreferredExtension;

I am attaching one that would not successfully read and providing links to two others since GitHub limits file attachment extensions. Are there encoders I need to enable?
plane

https://homepages.cae.wisc.edu/~ece533/images/barbara.bmp
https://file-examples-com.github.io/uploads/2017/10/file_example_TIFF_1MB.tiff

Regards,
Greg

@lilith
Copy link
Member

lilith commented Sep 3, 2020 via email

@thecaptncode
Copy link
Author

The bitmap image throws this:

ImageMalformed: NoEnabledDecoderFound: No ENABLED decoder found for file starting in [42, 4D, 36, 4, 4, 0, 0, 0, 0, 0, 36, 4] at
imageflow_core\src\codecs\mod.rs:153:20
https://github.com/imazen/imageflow/blob/1a7e1eecd8f04cab4413b48c2bf8bd5bbf140f5d/imageflow_core\src\codecs\mod.rs#L153
imageflow_core\src\context.rs:133:103
https://github.com/imazen/imageflow/blob/1a7e1eecd8f04cab4413b48c2bf8bd5bbf140f5d/imageflow_core\src\context.rs#L133
imageflow_core\src\context.rs:174:66
https://github.com/imazen/imageflow/blob/1a7e1eecd8f04cab4413b48c2bf8bd5bbf140f5d/imageflow_core\src\context.rs#L174
imageflow_abi\src\lib.rs:707:62
https://github.com/imazen/imageflow/blob/1a7e1eecd8f04cab4413b48c2bf8bd5bbf140f5d/imageflow_abi\src\lib.rs#L707

The gif throws this:

ImageMalformed: NoEnabledDecoderFound: No ENABLED decoder found for file starting in [42, 4D, FE, AF, 0, 0, 0, 0, 0, 0, 36, 0] at
imageflow_core\src\codecs\mod.rs:153:20
https://github.com/imazen/imageflow/blob/1a7e1eecd8f04cab4413b48c2bf8bd5bbf140f5d/imageflow_core\src\codecs\mod.rs#L153
imageflow_core\src\context.rs:133:103
https://github.com/imazen/imageflow/blob/1a7e1eecd8f04cab4413b48c2bf8bd5bbf140f5d/imageflow_core\src\context.rs#L133
imageflow_core\src\context.rs:174:66
https://github.com/imazen/imageflow/blob/1a7e1eecd8f04cab4413b48c2bf8bd5bbf140f5d/imageflow_core\src\context.rs#L174
imageflow_abi\src\lib.rs:707:62
https://github.com/imazen/imageflow/blob/1a7e1eecd8f04cab4413b48c2bf8bd5bbf140f5d/imageflow_abi\src\lib.rs#L707

The tiff throws this:

ImageMalformed: NoEnabledDecoderFound: No ENABLED decoder found for file starting in [49, 49, 2A, 0, D8, 37, 11, 0, D7, 55, 2, FF] at
imageflow_core\src\codecs\mod.rs:153:20
https://github.com/imazen/imageflow/blob/1a7e1eecd8f04cab4413b48c2bf8bd5bbf140f5d/imageflow_core\src\codecs\mod.rs#L153
imageflow_core\src\context.rs:133:103
https://github.com/imazen/imageflow/blob/1a7e1eecd8f04cab4413b48c2bf8bd5bbf140f5d/imageflow_core\src\context.rs#L133
imageflow_core\src\context.rs:174:66
https://github.com/imazen/imageflow/blob/1a7e1eecd8f04cab4413b48c2bf8bd5bbf140f5d/imageflow_core\src\context.rs#L174
imageflow_abi\src\lib.rs:707:62
https://github.com/imazen/imageflow/blob/1a7e1eecd8f04cab4413b48c2bf8bd5bbf140f5d/imageflow_abi\src\lib.rs#L707

All of that jives with what the first bytes of the files actually are. These are all test image files my testers found on the internet.

Thanks!
Greg

@lilith
Copy link
Member

lilith commented Sep 3, 2020

The supposed GIF is also a BMP file, thus the error. GIF images start with the letters "GIF".

Imageflow does not support .tiff files nor raw bitmaps, so you'll need to convert them to PNG format for Imageflow to work with them.

@lilith lilith closed this as completed Sep 3, 2020
@thecaptncode
Copy link
Author

That makes sense. I did not realize Imageflow didn't support tiff and raw bitmaps. Is that functionality planned for the future?

@lilith
Copy link
Member

lilith commented Sep 3, 2020 via email

@thecaptncode
Copy link
Author

Today I learned about the tiff security vulnerabilities allowing arbitrary code execution.
Thank you very much for the information and your quick response.

@lilith
Copy link
Member

lilith commented Sep 4, 2020 via email

@thecaptncode
Copy link
Author

I saw several listed but not that many. Wow. Since we let our users upload images, I need to detect and disallow tiffs by inspecting the first bytes. It looks like there are two possible headers in tiffs: 49 49 2A 00 or 4D 4D 00 2A

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants