Skip empty/small sections during entropy scan

Add a guard in scanForPackersAndCryptors_NET_and_Native to skip sections with FileOffset == 0 or FileSize < 0x1000 before calculating entropy. This avoids reading invalid/empty section data and reduces false/high-entropy detections for very small sections, improving robustness of packer/cryptor detection.
This commit is contained in:
DosX 2026-06-20 19:33:40 +03:00
commit d77aa6f6dd

View file

@ -2988,6 +2988,8 @@ function scanForPackersAndCryptors_NET_and_Native() { // For .NET and Native app
for (var t = 0; t < PE_Cached.numberOfSections && !isCompressedSectionPresent; t++) {
compressedSectionIndex = t;
if (PE.section[t].FileOffset === 0 || PE.section[t].FileSize < 0x1000) continue;
var sectionEntropy = PE.calculateEntropy(PE.getSectionFileOffset(compressedSectionIndex), PE.getSectionFileSize(compressedSectionIndex));
if (sectionEntropy > 7.4) {
log(logType.any, "Section #" + compressedSectionIndex + " (\"" + cleanSectionName(PE.getSectionName(compressedSectionIndex)) + "\") entropy: " + sectionEntropy);