Implement parsing for AMD-specific Zlib-compressed GUIDed section

Fix incorrect overflow check in parsing volume block map
This commit is contained in:
Nikolaj Schlej 2022-12-23 20:24:15 -08:00 committed by Nikolaj Schlej
parent 15026849d2
commit 7337f15ec9
9 changed files with 188 additions and 104 deletions

View file

@ -41,6 +41,9 @@ USTATUS decompress(const UByteArray & compressed, const UINT8 compressionType, U
// GZIP decompression routine
USTATUS gzipDecompress(const UByteArray & compressed, UByteArray & decompressed);
// ZLIB decompression routine
USTATUS zlibDecompress(const UByteArray& compressed, UByteArray& decompressed);
// 8bit sum calculation routine
UINT8 calculateSum8(const UINT8* buffer, UINT32 bufferSize);
@ -66,7 +69,7 @@ INTN findPattern(const UINT8 *pattern, const UINT8 *patternMask, UINTN patternSi
// Safely dereferences misaligned pointers
template <typename T>
inline T readUnaligned(const T *v) {
T tmp;
T tmp = {};
memcpy(&tmp, v, sizeof(T));
return tmp;
}