Browse Source

build fixes

pull/1760/head
Ildar Khayrutdinov 5 years ago
parent
commit
eb8b6f2586
  1. 32
      src/ImageSharp/Formats/Tiff/TiffDecoderCore.cs
  2. 2
      src/ImageSharp/Formats/Tiff/TiffThrowHelper.cs
  3. 2
      src/ImageSharp/Metadata/Profiles/Exif/Values/ExifLong8Array.cs

32
src/ImageSharp/Formats/Tiff/TiffDecoderCore.cs

@ -335,8 +335,20 @@ namespace SixLabors.ImageSharp.Formats.Tiff
int stripIndex = i; int stripIndex = i;
for (int planeIndex = 0; planeIndex < stripsPerPixel; planeIndex++) for (int planeIndex = 0; planeIndex < stripsPerPixel; planeIndex++)
{ {
ulong offset = stripOffsets.GetValue(stripIndex) switch { ulong val => val, Number val => (uint)val }; ulong offset = stripOffsets.GetValue(stripIndex) switch
ulong count = stripByteCounts.GetValue(stripIndex) switch { ulong val => val, Number val => (uint)val }; {
ulong val => val,
Number val => (uint)val,
_ => throw TiffThrowHelper.ThrowImageFormatException("Expected Number or Long8 array")
};
ulong count = stripByteCounts.GetValue(stripIndex) switch
{
ulong val => val,
Number val => (uint)val,
_ => throw TiffThrowHelper.ThrowImageFormatException("Expected Number or Long8 array")
};
decompressor.Decompress( decompressor.Decompress(
this.inputStream, this.inputStream,
offset, offset,
@ -423,8 +435,20 @@ namespace SixLabors.ImageSharp.Formats.Tiff
break; break;
} }
ulong offset = stripOffsets.GetValue(stripIndex) switch { ulong val => val, Number val => (uint)val }; ulong offset = stripOffsets.GetValue(stripIndex) switch
ulong count = stripByteCounts.GetValue(stripIndex) switch { ulong val => val, Number val => (uint)val }; {
ulong val => val,
Number val => (uint)val,
_ => throw TiffThrowHelper.ThrowImageFormatException("Expected Number or Long8 array")
};
ulong count = stripByteCounts.GetValue(stripIndex) switch
{
ulong val => val,
Number val => (uint)val,
_ => throw TiffThrowHelper.ThrowImageFormatException("Expected Number or Long8 array")
};
decompressor.Decompress( decompressor.Decompress(
this.inputStream, this.inputStream,
offset, offset,

2
src/ImageSharp/Formats/Tiff/TiffThrowHelper.cs

@ -16,7 +16,7 @@ namespace SixLabors.ImageSharp.Formats.Tiff
/// </summary> /// </summary>
/// <param name="errorMessage">The error message for the exception.</param> /// <param name="errorMessage">The error message for the exception.</param>
[MethodImpl(MethodImplOptions.NoInlining)] [MethodImpl(MethodImplOptions.NoInlining)]
public static void ThrowImageFormatException(string errorMessage) => throw new ImageFormatException(errorMessage); public static Exception ThrowImageFormatException(string errorMessage) => throw new ImageFormatException(errorMessage);
[MethodImpl(InliningOptions.ColdPath)] [MethodImpl(InliningOptions.ColdPath)]
public static Exception NotSupportedDecompressor(string compressionType) => throw new NotSupportedException($"Not supported decoder compression method: {compressionType}"); public static Exception NotSupportedDecompressor(string compressionType) => throw new NotSupportedException($"Not supported decoder compression method: {compressionType}");

2
src/ImageSharp/Metadata/Profiles/Exif/Values/ExifLong8Array.cs

@ -31,7 +31,7 @@ namespace SixLabors.ImageSharp.Metadata.Profiles.Exif
return ExifDataType.Long; return ExifDataType.Long;
} }
foreach (ulong value in this.Value) foreach (ulong value in this.Value)
{ {
if (value > uint.MaxValue) if (value > uint.MaxValue)
{ {

Loading…
Cancel
Save