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

File (detected as bmp) fails to open, consumes a lot of memory #2696

Open
4 tasks done
skanejohan opened this issue Mar 13, 2024 · 4 comments
Open
4 tasks done

File (detected as bmp) fails to open, consumes a lot of memory #2696

skanejohan opened this issue Mar 13, 2024 · 4 comments

Comments

@skanejohan
Copy link

Prerequisites

  • I have written a descriptive issue title
  • I have verified that I am running the latest version of ImageSharp
  • I have verified if the problem exist in both DEBUG and RELEASE mode
  • I have searched open and closed issues to ensure it has not already been reported

ImageSharp version

3.1.3

Other ImageSharp packages and versions

N/A

Environment (Operating system, version and so on)

Windows 11

.NET Framework version

.net 8

Description

The attached (zipped) file, 126 bytes long, gives an out-of-memory error when I try to open it with the following code:

using FileStream stream = File.OpenRead("00271-imageworsener-leftshift");
SixLabors.ImageSharp.Image.Load(stream);

I believe there is a problem with the image dimensions - BmpDecoderCore.ReadImageHeaders sets this.infoHeader.Width and this.infoHeader.Height to very high values which tries to create a huge image in BmpDecoderCore.Decode().

Steps to Reproduce

See description.

Images

00271-imageworsener-leftshift.zip

@JimBobSquarePants
Copy link
Member

Can you please re-upload the zip file. GitHub is showing varnish cache errors when I try to download it.

@skanejohan
Copy link
Author

@skanejohan
Copy link
Author

Our testers reported this, and it turns out the file is from a test set used to test ImageMagick - https://github.com/rip1s/Fuzzing-ImageMagick

@JimBobSquarePants
Copy link
Member

Thanks, I'll look at this today.

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

Successfully merging a pull request may close this issue.

2 participants