case 4690 - CA2022: read the PE header with ReadAtLeast for the licence build date

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-22 19:39:11 -07:00
parent 76dab8d865
commit 77b825a064
2 changed files with 5 additions and 2 deletions

View File

@@ -872,7 +872,9 @@ namespace AyaNova.Util
using (var file = new FileStream(filePath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
{
file.Read(bytes, 0, bytes.Length);
//CA2022: a single Read may return fewer bytes than asked for, this keeps reading until full or end of file and never throws
//(used for the licence build date check so a short read must not become an exception)
file.ReadAtLeast(bytes, bytes.Length, throwOnEndOfStream: false);
}
var headerPos = BitConverter.ToInt32(bytes, peHeaderOffset);