Browse Source

Increase LimitAllocatorBufferCapacity to 400 for RLE tests.

Add info to ImageFormatException that this may happen for large RLE images
pull/1109/head
Brian Popow 6 years ago
parent
commit
ba371349b3
  1. 2
      src/ImageSharp/Formats/Bmp/BmpDecoder.cs
  2. 4
      tests/ImageSharp.Tests/Formats/Bmp/BmpDecoderTests.cs

2
src/ImageSharp/Formats/Bmp/BmpDecoder.cs

@ -45,7 +45,7 @@ namespace SixLabors.ImageSharp.Formats.Bmp
// TODO: use InvalidImageContentException here, if we decide to define it
// https://github.com/SixLabors/ImageSharp/issues/1110
throw new ImageFormatException($"Can not decode image. Failed to allocate buffers for possibly degenerate dimensions: {dims.Width}x{dims.Height}.", ex);
throw new ImageFormatException($"Can not decode image. Failed to allocate buffers for possibly degenerate dimensions: {dims.Width}x{dims.Height}. This error can happen for very large RLE bitmaps, which are not supported.", ex);
}
}

4
tests/ImageSharp.Tests/Formats/Bmp/BmpDecoderTests.cs

@ -261,7 +261,7 @@ namespace SixLabors.ImageSharp.Tests.Formats.Bmp
{
if (enforceDiscontiguousBuffers)
{
provider.LimitAllocatorBufferCapacity().InBytes(100);
provider.LimitAllocatorBufferCapacity().InBytes(400);
}
using (Image<TPixel> image = provider.GetImage(new BmpDecoder { RleSkippedPixelHandling = RleSkippedPixelHandling.FirstColorOfPalette }))
@ -283,7 +283,7 @@ namespace SixLabors.ImageSharp.Tests.Formats.Bmp
{
if (enforceNonContiguous)
{
provider.LimitAllocatorBufferCapacity().InBytes(50);
provider.LimitAllocatorBufferCapacity().InBytes(400);
}
using (Image<TPixel> image = provider.GetImage(new BmpDecoder { RleSkippedPixelHandling = RleSkippedPixelHandling.Black }))

Loading…
Cancel
Save