diff --git a/parser/include/bearparser/pe/RelocDirWrapper.h b/parser/include/bearparser/pe/RelocDirWrapper.h index 15d8c6c94..1f484e2e7 100644 --- a/parser/include/bearparser/pe/RelocDirWrapper.h +++ b/parser/include/bearparser/pe/RelocDirWrapper.h @@ -48,7 +48,7 @@ class RelocBlockWrapper : public ExeNodeWrapper }; RelocBlockWrapper(Executable *pe, RelocDirWrapper *parentDir, size_t entryNumber) - : ExeNodeWrapper(pe, parentDir, entryNumber), cachedRaw(INVALID_ADDR), cachedMaxNum(-1) { this->parentDir = parentDir; wrap(); } + : ExeNodeWrapper(pe, parentDir, entryNumber), cachedRaw(INVALID_ADDR), cachedMaxNum(0) { this->parentDir = parentDir; wrap(); } bool wrap(); diff --git a/parser/pe/RelocDirWrapper.cpp b/parser/pe/RelocDirWrapper.cpp index eb108963b..dccc1216a 100644 --- a/parser/pe/RelocDirWrapper.cpp +++ b/parser/pe/RelocDirWrapper.cpp @@ -78,7 +78,7 @@ bool RelocBlockWrapper::wrap() if (!reloc) return false; size_t maxSize = reloc->SizeOfBlock; - parsedSize = sizeof(reloc->VirtualAddress) + sizeof(reloc->SizeOfBlock); + parsedSize = sizeof(IMAGE_BASE_RELOCATION); // the block begins with IMAGE_BASE_RELOCATION record size_t entryId = 0; while (parsedSize < maxSize) { @@ -88,7 +88,7 @@ bool RelocBlockWrapper::wrap() delete entry; break; } - this->parsedSize += sizeof(WORD); + this->parsedSize += sizeof(pe::BASE_RELOCATION_ENTRY); this->entries.push_back(entry); } return true;