From 5019d0bb08a6c1bd1f3146b02ffd0e99806a5c03 Mon Sep 17 00:00:00 2001 From: MPCoreDeveloper Date: Fri, 4 Sep 2026 21:29:39 +0200 Subject: [PATCH] sonar: drop always-true fileLength bound (S2589) RangeMarkerReadLimitBytes (32 MB) already guarantees the (int) cast is safe, so fileLength <= int.MaxValue is redundant. --- src/SharpCoreDB/Services/Storage.Append.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SharpCoreDB/Services/Storage.Append.cs b/src/SharpCoreDB/Services/Storage.Append.cs index f53abfaa..94a5b0c3 100644 --- a/src/SharpCoreDB/Services/Storage.Append.cs +++ b/src/SharpCoreDB/Services/Storage.Append.cs @@ -697,7 +697,7 @@ public void TombstoneRecords(string path, long[] offsets) if (offsets.Length >= 64) { fileLength = File.Exists(path) ? new FileInfo(path).Length : 0; - if (fileLength > 0 && fileLength <= RangeMarkerReadLimitBytes && fileLength <= int.MaxValue) + if (fileLength > 0 && fileLength <= RangeMarkerReadLimitBytes) { wholeFile = new byte[(int)fileLength]; if (RandomAccess.Read(readHandle, wholeFile, 0) != fileLength)