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

Fix #2779 buffer overrun #2780

Merged
merged 3 commits into from
Jul 26, 2024
Merged

Conversation

KirillAldashkin
Copy link
Contributor

@KirillAldashkin KirillAldashkin commented Jul 22, 2024

Prerequisites

  • I have written a descriptive pull-request title
  • I have verified that there are no overlapping pull-requests open
  • I have verified that I am following the existing coding patterns and practice as demonstrated in the repository. These follow strict Stylecop rules 👮.
  • I have provided test coverage for my change (where applicable)

Description

Fix #2779 by accounting pixel size. Also fixed some width*height multuplication overflows:

using SixLabors.ImageSharp;
using SixLabors.ImageSharp.PixelFormats;

Rgba64[] data = new Rgba64[65536];
using Image<Rgba64> img = Image.WrapMemory<Rgba64>(data, 65537, 65536);
// doesn't throw here but will blow up later

// ...here for example
img.SaveAsPng("output.png");

@CLAassistant
Copy link

CLAassistant commented Jul 22, 2024

CLA assistant check
All committers have signed the CLA.

@KirillAldashkin KirillAldashkin marked this pull request as ready for review July 22, 2024 19:35
Copy link
Member

@JimBobSquarePants JimBobSquarePants left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This all looks great. Thanks so much for your help!

@JimBobSquarePants JimBobSquarePants merged commit 57ecebf into SixLabors:main Jul 26, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants