From 6f495f1642e580ac6e4e0b401dddf1533744e30d Mon Sep 17 00:00:00 2001 From: Brian Popow Date: Mon, 17 Jan 2022 20:40:30 +0100 Subject: [PATCH] Review suggestion from gfoidl: Change condition to (offset <= this.Data.Length - byteCount) --- src/ImageSharp/Metadata/Profiles/IPTC/IptcProfile.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ImageSharp/Metadata/Profiles/IPTC/IptcProfile.cs b/src/ImageSharp/Metadata/Profiles/IPTC/IptcProfile.cs index 4eb0409db..610e52d1c 100644 --- a/src/ImageSharp/Metadata/Profiles/IPTC/IptcProfile.cs +++ b/src/ImageSharp/Metadata/Profiles/IPTC/IptcProfile.cs @@ -307,7 +307,7 @@ namespace SixLabors.ImageSharp.Metadata.Profiles.Iptc break; } - if (isValidEntry && byteCount > 0 && (offset + byteCount <= this.Data.Length)) + if (isValidEntry && byteCount > 0 && (offset <= this.Data.Length - byteCount)) { var iptcData = new byte[byteCount]; Buffer.BlockCopy(this.Data, offset, iptcData, 0, (int)byteCount);