Browse Source

elide further bound checks

Co-authored-by: Günther Foidl <gue@korporal.at>
pull/1773/head
Anton Firszov 5 years ago
committed by GitHub
parent
commit
ad976f12d8
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      src/ImageSharp/Formats/Jpeg/Components/Decoder/ColorConverters/JpegColorConverter.FromGrayScaleBasic.cs

4
src/ImageSharp/Formats/Jpeg/Components/Decoder/ColorConverters/JpegColorConverter.FromGrayScaleBasic.cs

@ -37,11 +37,11 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.Components.Decoder.ColorConverters
float scaleValue = 1f / maxValue;
values[0] *= scaleValue;
if (values.Length > 1)
if ((uint)values.Length > 1)
{
values[1] *= scaleValue;
if (values.Length > 2)
if ((uint)values.Length > 2)
{
values[2] *= scaleValue;
}

Loading…
Cancel
Save