From 40b7be804173c56ba8eb5ea2f3b3c305caea3df2 Mon Sep 17 00:00:00 2001 From: Ildar Khayrutdinov Date: Mon, 27 Jan 2025 08:09:59 +0300 Subject: [PATCH] fix allocation (CA2014) --- src/ImageSharp/Metadata/Profiles/Exif/ExifReader.cs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/ImageSharp/Metadata/Profiles/Exif/ExifReader.cs b/src/ImageSharp/Metadata/Profiles/Exif/ExifReader.cs index e9683d615..1c8cf227c 100644 --- a/src/ImageSharp/Metadata/Profiles/Exif/ExifReader.cs +++ b/src/ImageSharp/Metadata/Profiles/Exif/ExifReader.cs @@ -191,10 +191,7 @@ internal abstract class BaseExifReader { do { - int sz = this.subIfds.Count; - Span buf = sz <= 256 ? stackalloc ulong[sz] : new ulong[sz]; - - this.subIfds.CopyTo(buf); + ulong[] buf = [.. this.subIfds]; this.subIfds.Clear(); foreach (ulong subIfdOffset in buf) { @@ -456,6 +453,7 @@ internal abstract class BaseExifReader ExifTagValue.TileByteCounts => new ExifLong8Array(ExifTagValue.TileByteCounts), _ => ExifValues.Create(tag) ?? ExifValues.Create(tag, dataType, numberOfComponents), }; + if (exifValue is null) { this.AddInvalidTag(new UnkownExifTag(tag));