-
-
Notifications
You must be signed in to change notification settings - Fork 887
Closed
Labels
Description
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
DEBUGandRELEASEmode - I have searched open and closed issues to ensure it has not already been reported
Description
Image.Identify throws ArgumentOutOfRangeException when provided an empty unseekable stream.
Stack trace:
System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values.
Parameter name: value
at SixLabors.ImageSharp.IO.ChunkedMemoryStream.ThrowArgumentOutOfRange(String value)
at SixLabors.ImageSharp.IO.ChunkedMemoryStream.set_Position(Int64 value)
at SixLabors.ImageSharp.Image.WithSeekableStream[T](Configuration configuration, Stream stream, Func`2 action)
at SixLabors.ImageSharp.Image.Identify(Configuration configuration, Stream stream, IImageFormat& format)
at SixLabors.ImageSharp.Image.Identify(Stream stream)
Steps to Reproduce
using SixLabors.ImageSharp;
using System.IO;
using System.IO.Compression;
internal class Test
{
public static void Main()
{
using (var zipFile = new ZipArchive(new MemoryStream(new byte[] {
0x50, 0x4B, 0x03, 0x04, 0x0A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0xAF,
0x94, 0x53, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x6D, 0x79, 0x73, 0x74, 0x65, 0x72,
0x79, 0x50, 0x4B, 0x01, 0x02, 0x3F, 0x00, 0x0A, 0x00, 0x00, 0x00, 0x00,
0x00, 0x77, 0xAF, 0x94, 0x53, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x24, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6D,
0x79, 0x73, 0x74, 0x65, 0x72, 0x79, 0x0A, 0x00, 0x20, 0x00, 0x00, 0x00,
0x00, 0x00, 0x01, 0x00, 0x18, 0x00, 0x46, 0x82, 0xFF, 0x91, 0x27, 0xF6,
0xD7, 0x01, 0x55, 0xA1, 0xF9, 0x91, 0x27, 0xF6, 0xD7, 0x01, 0x55, 0xA1,
0xF9, 0x91, 0x27, 0xF6, 0xD7, 0x01, 0x50, 0x4B, 0x05, 0x06, 0x00, 0x00,
0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x59, 0x00, 0x00, 0x00, 0x25, 0x00,
0x00, 0x00, 0x00, 0x00 })))
using (var stream = zipFile.Entries[0].Open())
Image.Identify(stream);
}
}System Configuration
- ImageSharp version: 2.0.0-alpha.0.140
- Other ImageSharp packages and versions: N/A
- Environment (Operating system, version and so on): Windows 10
- .NET Framework version: 4.8.1
- Additional information: N/A
JimBobSquarePants