Browse Source

Merge pull request #1197 from SixLabors/fixForVeryLargeJpg

Change Scanlines and SamplesPerLine from short to int
pull/1574/head
Brian Popow 6 years ago
committed by GitHub
parent
commit
2f8ebf2107
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 8
      src/ImageSharp/Formats/Jpeg/Components/Decoder/JpegFrame.cs
  2. 4
      src/ImageSharp/Formats/Jpeg/JpegDecoderCore.cs

8
src/ImageSharp/Formats/Jpeg/Components/Decoder/JpegFrame.cs

@ -1,4 +1,4 @@
// Copyright (c) Six Labors and contributors.
// Copyright (c) Six Labors and contributors.
// Licensed under the GNU Affero General Public License, Version 3.
using System;
@ -28,12 +28,12 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.Components.Decoder
/// <summary>
/// Gets or sets the number of scanlines within the frame.
/// </summary>
public short Scanlines { get; set; }
public int Scanlines { get; set; }
/// <summary>
/// Gets or sets the number of samples per scanline.
/// </summary>
public short SamplesPerLine { get; set; }
public int SamplesPerLine { get; set; }
/// <summary>
/// Gets or sets the number of components within a frame. In progressive frames this value can range from only 1 to 4.
@ -105,4 +105,4 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.Components.Decoder
}
}
}
}
}

4
src/ImageSharp/Formats/Jpeg/JpegDecoderCore.cs

@ -841,8 +841,8 @@ namespace SixLabors.ImageSharp.Formats.Jpeg
Extended = frameMarker.Marker == JpegConstants.Markers.SOF1,
Progressive = frameMarker.Marker == JpegConstants.Markers.SOF2,
Precision = this.temp[0],
Scanlines = (short)((this.temp[1] << 8) | this.temp[2]),
SamplesPerLine = (short)((this.temp[3] << 8) | this.temp[4]),
Scanlines = (this.temp[1] << 8) | this.temp[2],
SamplesPerLine = (this.temp[3] << 8) | this.temp[4],
ComponentCount = this.temp[5]
};

Loading…
Cancel
Save