Browse Source

Don't use stackalloc for two bytes

This avoids the stack cookie
pull/3153/head
winscripter 2 days ago
parent
commit
7b8749d8dc
  1. 2
      src/ImageSharp/Formats/Jxl/Processing/Decoder/JxlDecoderCore.cs

2
src/ImageSharp/Formats/Jxl/Processing/Decoder/JxlDecoderCore.cs

@ -1505,7 +1505,7 @@ internal sealed class JxlDecoderCore : ImageDecoderCore, IDisposable
{ {
if (!this.gotCodestreamSignature) if (!this.gotCodestreamSignature)
{ {
Span<byte> fileSignature = stackalloc byte[2]; Span<byte> fileSignature = [0, 0];
stream.ReadExactly(fileSignature); stream.ReadExactly(fileSignature);
if (fileSignature[0] != 0xFF || fileSignature[1] != JxlShared.CodestreamMarker) if (fileSignature[0] != 0xFF || fileSignature[1] != JxlShared.CodestreamMarker)

Loading…
Cancel
Save