FilePortion: force members initialization

This commit fixes a bug triggered by the fact that the constructor of
the `FilePortion` class was not initializing fields featuring a "native"
type (which are therefore not automatically zero-initialized).

In particular, this bug was triggered when dealing with a dynamic binary
lacking the sections for dynamic relocations.
This commit is contained in:
Alessandro Di Federico
2018-09-13 22:55:38 +02:00
parent e82635ee0b
commit 4557c91457
+9 -6
View File
@@ -248,6 +248,15 @@ BinaryFile::BinaryFile(std::string FilePath,
}
class FilePortion {
private:
bool HasAddress;
bool HasSize;
uint64_t Size;
uint64_t Address;
public:
FilePortion() : HasAddress(false), HasSize(false), Size(0), Address(0) { }
public:
void setAddress(uint64_t Address) {
HasAddress = true;
@@ -305,12 +314,6 @@ public:
abort();
}
private:
bool HasAddress;
bool HasSize;
uint64_t Size;
uint64_t Address;
};
template<typename T, bool HasAddend>