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:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user