Loosen GZip header detection threshold to prevent false negatives
This commit is contained in:
parent
1abbf3044e
commit
ae713dd15d
@ -364,7 +364,7 @@ namespace PeepoHappy
|
|||||||
combinedByte |= (upperCaseHexCharToNibble(upperCaseHexChars[(byteIndex * hexDigitsPerByte) + 1]) << 0);
|
combinedByte |= (upperCaseHexCharToNibble(upperCaseHexChars[(byteIndex * hexDigitsPerByte) + 1]) << 0);
|
||||||
outBytes[byteIndex] = combinedByte;
|
outBytes[byteIndex] = combinedByte;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -433,14 +433,15 @@ namespace PeepoHappy
|
|||||||
const GZipHeader* header = reinterpret_cast<const GZipHeader*>(fileContent);
|
const GZipHeader* header = reinterpret_cast<const GZipHeader*>(fileContent);
|
||||||
|
|
||||||
// NOTE: This is by no means comprehensive but should be enough for datatable files and (not falsely) detecting encrypted data
|
// NOTE: This is by no means comprehensive but should be enough for datatable files and (not falsely) detecting encrypted data
|
||||||
#if 1
|
#if 0
|
||||||
return (header->Magic[0] == 0x1F && header->Magic[1] == 0x8B) &&
|
return (header->Magic[0] == 0x1F && header->Magic[1] == 0x8B) &&
|
||||||
(header->CompressionMethod == Z_DEFLATED) &&
|
(header->CompressionMethod == Z_DEFLATED) &&
|
||||||
(header->Flags == 0) &&
|
(header->Flags == 0) &&
|
||||||
(header->Timestamp == 0) &&
|
(header->Timestamp == 0) &&
|
||||||
(header->ExtraFlags == 0);
|
(header->ExtraFlags == 0);
|
||||||
#else // DEBUG: Less precise check for FArc testing
|
#else // NOTE: Less precise because becuase of some false negatives
|
||||||
return (header->Magic[0] == 0x1F && header->Magic[1] == 0x8B) && (header->CompressionMethod == Z_DEFLATED);
|
return (header->Magic[0] == 0x1F && header->Magic[1] == 0x8B) &&
|
||||||
|
(header->CompressionMethod == Z_DEFLATED);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user