Browse Source

Fix build error

pull/2192/head
Brian Popow 4 years ago
parent
commit
d187803adc
  1. 15
      src/ImageSharp/Formats/Bmp/BmpInfoHeader.cs

15
src/ImageSharp/Formats/Bmp/BmpInfoHeader.cs

@ -66,6 +66,16 @@ namespace SixLabors.ImageSharp.Formats.Bmp
/// </summary>
public const int HeaderSizeSize = 4;
/// <summary>
/// Maximum dimensions of a bitmap with or height: 2**31 - 1, since width and height are int32
/// </summary>
private const int MaximumBmpDimension = 2147483647;
/// <summary>
/// Maximum size of a bitmap width * height: 2**32, since size is uint32.
/// </summary>
private const long MaximumBmpSize = 4294967296;
public BmpInfoHeader(
int headerSize,
int width,
@ -545,8 +555,6 @@ namespace SixLabors.ImageSharp.Formats.Bmp
internal void VerifyDimensions()
{
const int MaximumBmpDimension = 2147483647; // 2**31 - 1, since width & height are int32
if (this.Width > MaximumBmpDimension || this.Height > MaximumBmpDimension)
{
throw new InvalidOperationException(
@ -554,8 +562,7 @@ namespace SixLabors.ImageSharp.Formats.Bmp
+ $"bigger then the max allowed '{MaximumBmpDimension}'");
}
const long MaximumBmpSize = 4294967296; // 2**32, since size is uint32
const long size = (long)this.Width * (long)this.Height;
long size = this.Width * this.Height;
if (size > MaximumBmpSize)
{
throw new InvalidOperationException(

Loading…
Cancel
Save