From 55d01f231f840f3d57e997be43040e85fb3dc205 Mon Sep 17 00:00:00 2001 From: Dmitry Pentin Date: Thu, 14 Apr 2022 15:03:59 +0300 Subject: [PATCH] Added guard clause of empty exif strings --- .../Metadata/Profiles/Exif/ExifEncodedStringHelpers.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/ImageSharp/Metadata/Profiles/Exif/ExifEncodedStringHelpers.cs b/src/ImageSharp/Metadata/Profiles/Exif/ExifEncodedStringHelpers.cs index 4dc7f8398..4ec9b3267 100644 --- a/src/ImageSharp/Metadata/Profiles/Exif/ExifEncodedStringHelpers.cs +++ b/src/ImageSharp/Metadata/Profiles/Exif/ExifEncodedStringHelpers.cs @@ -84,6 +84,11 @@ namespace SixLabors.ImageSharp.Metadata.Profiles.Exif => encoding.GetBytes(value.AsSpan(), destination); #else { + if (value.Length == 0) + { + return 0; + } + fixed (char* c = value) { fixed (byte* b = destination)