Browse Source

Simplify

pull/3153/head
winscripter 1 week ago
parent
commit
2b43fd6d14
  1. 15
      src/ImageSharp/Formats/Jxl/Processing/Decoder/JxlDecoderCore.cs

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

@ -2314,11 +2314,6 @@ internal sealed class JxlDecoderCore : ImageDecoderCore, IDisposable
if (this.boxType == JxlBoxTypes.Brob) if (this.boxType == JxlBoxTypes.Brob)
{ {
if (this.availableInput < headerSize + 4)
{
return NeedMoreInput;
}
this.boxDecodedType = BitConverter.ToInt32(this.nextInput!.Memory.Span[(int)headerSize..]); this.boxDecodedType = BitConverter.ToInt32(this.nextInput!.Memory.Span[(int)headerSize..]);
} }
else else
@ -2423,11 +2418,6 @@ internal sealed class JxlDecoderCore : ImageDecoderCore, IDisposable
throw new InvalidOperationException("The file type box is too small"); throw new InvalidOperationException("The file type box is too small");
} }
if (this.availableInput < 8)
{
return NeedMoreInput;
}
if (BinaryUtils.ReadInt32BigEndian(stream) != 0x6A786C20) // Bytes "jxl " in Big Endian if (BinaryUtils.ReadInt32BigEndian(stream) != 0x6A786C20) // Bytes "jxl " in Big Endian
{ {
throw new InvalidOperationException("File type box major brand must be \"jxl \""); throw new InvalidOperationException("File type box major brand must be \"jxl \"");
@ -2449,11 +2439,6 @@ internal sealed class JxlDecoderCore : ImageDecoderCore, IDisposable
throw new InvalidOperationException("Cannot have jxlp box after last jxlp box"); throw new InvalidOperationException("Cannot have jxlp box after last jxlp box");
} }
if (this.availableInput < 4)
{
return NeedMoreInput;
}
if (!this.boxContentsUnbounded && this.boxContentsSize < 4) if (!this.boxContentsUnbounded && this.boxContentsSize < 4)
{ {
throw new InvalidOperationException("jxlp box is too small to contain an index"); throw new InvalidOperationException("jxlp box is too small to contain an index");

Loading…
Cancel
Save