James Jackson-South
8 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with
3 additions and
6 deletions
-
src/ImageSharp/Formats/Jpeg/GolangPort/GolangJpegDecoderCore.cs
-
src/ImageSharp/Formats/Jpeg/PdfJsPort/PdfJsJpegDecoderCore.cs
|
|
|
@ -338,6 +338,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.GolangPort |
|
|
|
|
|
|
|
break; |
|
|
|
case JpegConstants.Markers.DHT: |
|
|
|
|
|
|
|
if (metadataOnly) |
|
|
|
{ |
|
|
|
this.InputProcessor.Skip(remaining); |
|
|
|
@ -721,7 +722,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.GolangPort |
|
|
|
{ |
|
|
|
if (remaining < 17) |
|
|
|
{ |
|
|
|
throw new ImageFormatException("DHT has wrong length"); |
|
|
|
throw new ImageFormatException($"DHT has wrong length. {remaining}"); |
|
|
|
} |
|
|
|
|
|
|
|
this.InputProcessor.ReadFull(this.Temp, 0, 17); |
|
|
|
|
|
|
|
@ -270,6 +270,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort |
|
|
|
} |
|
|
|
|
|
|
|
case JpegConstants.Markers.DHT: |
|
|
|
|
|
|
|
if (metadataOnly) |
|
|
|
{ |
|
|
|
this.InputStream.Skip(remaining); |
|
|
|
@ -698,11 +699,6 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort |
|
|
|
/// <param name="remaining">The remaining bytes in the segment block.</param>
|
|
|
|
private void ProcessDefineHuffmanTablesMarker(int remaining) |
|
|
|
{ |
|
|
|
if (remaining < 17) |
|
|
|
{ |
|
|
|
throw new ImageFormatException($"DHT has wrong length: {remaining}"); |
|
|
|
} |
|
|
|
|
|
|
|
using (IManagedByteBuffer huffmanData = this.configuration.MemoryAllocator.AllocateCleanManagedByteBuffer(256)) |
|
|
|
{ |
|
|
|
ref byte huffmanDataRef = ref MemoryMarshal.GetReference(huffmanData.GetSpan()); |
|
|
|
|