Skip to content

AccessViolationException when opening GIF #2883

@Erik-White

Description

@Erik-White

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.6

Other ImageSharp packages and versions

N/A

Environment (Operating system, version and so on)

Windows 11

.NET Framework version

.NET 8.0

Description

When loading the attached GIF a System.AccessViolationException is thrown:

 	SixLabors.ImageSharp.dll!SixLabors.ImageSharp.Formats.Gif.GifDecoderCore.ReadFrameColors<SixLabors.ImageSharp.PixelFormats.Rgba32>(SixLabors.ImageSharp.IO.BufferedReadStream stream, ref SixLabors.ImageSharp.Image<SixLabors.ImageSharp.PixelFormats.Rgba32> image, ref SixLabors.ImageSharp.ImageFrame<SixLabors.ImageSharp.PixelFormats.Rgba32> previousFrame, System.ReadOnlySpan<SixLabors.ImageSharp.PixelFormats.Rgb24> colorTable, SixLabors.ImageSharp.Formats.Gif.GifImageDescriptor descriptor)	Unknown
 	SixLabors.ImageSharp.dll!SixLabors.ImageSharp.Formats.Gif.GifDecoderCore.ReadFrame<SixLabors.ImageSharp.PixelFormats.Rgba32>(SixLabors.ImageSharp.IO.BufferedReadStream stream, ref SixLabors.ImageSharp.Image<SixLabors.ImageSharp.PixelFormats.Rgba32> image, ref SixLabors.ImageSharp.ImageFrame<SixLabors.ImageSharp.PixelFormats.Rgba32> previousFrame)	Unknown
 	SixLabors.ImageSharp.dll!SixLabors.ImageSharp.Formats.Gif.GifDecoderCore.Decode<SixLabors.ImageSharp.PixelFormats.Rgba32>(SixLabors.ImageSharp.IO.BufferedReadStream stream, System.Threading.CancellationToken cancellationToken)	Unknown
 	SixLabors.ImageSharp.dll!SixLabors.ImageSharp.Formats.ImageDecoderCore.Decode<SixLabors.ImageSharp.PixelFormats.Rgba32>(SixLabors.ImageSharp.Configuration configuration, System.IO.Stream stream, System.Threading.CancellationToken cancellationToken)	Unknown
 	SixLabors.ImageSharp.dll!SixLabors.ImageSharp.Formats.Gif.GifDecoder.Decode<SixLabors.ImageSharp.PixelFormats.Rgba32>(SixLabors.ImageSharp.Formats.DecoderOptions options, System.IO.Stream stream, System.Threading.CancellationToken cancellationToken)	Unknown
 	SixLabors.ImageSharp.dll!SixLabors.ImageSharp.Formats.Gif.GifDecoder.Decode(SixLabors.ImageSharp.Formats.DecoderOptions options, System.IO.Stream stream, System.Threading.CancellationToken cancellationToken)	Unknown
 	SixLabors.ImageSharp.dll!SixLabors.ImageSharp.Formats.ImageDecoder.Decode.AnonymousMethod__0(System.IO.Stream s)	Unknown
 	SixLabors.ImageSharp.dll!SixLabors.ImageSharp.Formats.ImageDecoder.WithSeekableStream.__PerformActionAndResetPosition|11_0<SixLabors.ImageSharp.Image>(System.IO.Stream s, long position, ref SixLabors.ImageSharp.Formats.ImageDecoder.<>c__DisplayClass11_0<SixLabors.ImageSharp.Image> value)	Unknown
 	SixLabors.ImageSharp.dll!SixLabors.ImageSharp.Formats.ImageDecoder.WithSeekableStream<SixLabors.ImageSharp.Image>(SixLabors.ImageSharp.Formats.DecoderOptions options, System.IO.Stream stream, System.Func<System.IO.Stream, SixLabors.ImageSharp.Image> action)	Unknown
 	SixLabors.ImageSharp.dll!SixLabors.ImageSharp.Formats.ImageDecoder.Decode(SixLabors.ImageSharp.Formats.DecoderOptions options, System.IO.Stream stream)	Unknown
 	SixLabors.ImageSharp.dll!SixLabors.ImageSharp.Image.Decode(SixLabors.ImageSharp.Formats.DecoderOptions options, System.IO.Stream stream)	Unknown
 	SixLabors.ImageSharp.dll!SixLabors.ImageSharp.Image.Load.AnonymousMethod__0(System.IO.Stream s)	Unknown
 	SixLabors.ImageSharp.dll!SixLabors.ImageSharp.Image.WithSeekableStream<System.__Canon>(SixLabors.ImageSharp.Formats.DecoderOptions options, System.IO.Stream stream, System.Func<System.IO.Stream, System.__Canon> action)	Unknown
 	SixLabors.ImageSharp.dll!SixLabors.ImageSharp.Image.Load(SixLabors.ImageSharp.Formats.DecoderOptions options, System.IO.Stream stream)	Unknown
 	SixLabors.ImageSharp.dll!SixLabors.ImageSharp.Image.Load(SixLabors.ImageSharp.Formats.DecoderOptions options, string path)	Unknown
 	SixLabors.ImageSharp.dll!SixLabors.ImageSharp.Image.Load(string path)	Unknown
>	ConsoleApp1.dll!Program.<Main>$(string[] args) Line 4	C#

Steps to Reproduce

Try to load the image: using var image = Image.Load(@"CDA12C1D55575838C99DAD05F4284425.gif");

Images

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions