-
Notifications
You must be signed in to change notification settings - Fork 952
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Corruption check is complete #281
Changes from 6 commits
ffef28a
31fafae
92b69d0
b5fda91
6cb9ace
45aac50
440ddde
8669c5a
ba7787d
0e05056
cab9451
93fb2df
67e62a2
8cf198f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,6 +21,20 @@ | |
namespace retdec { | ||
namespace fileformat { | ||
|
||
/** | ||
* LoaderErrorInfo - common structure that contains loader error code, error message and user-friendly error message | ||
*/ | ||
|
||
struct LoaderErrorInfo | ||
{ | ||
LoaderErrorInfo() : loaderErrorCode(0), loaderError(nullptr), loaderErrorUserFriendly(nullptr) | ||
{} | ||
|
||
std::uint32_t loaderErrorCode; // Loader error code, cast to uint32_t | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There are tabs in-between name of the attribute and comment. Please use spaces here. We use tabs only for indentation. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed in commit cab9451 |
||
const char * loaderError; | ||
const char * loaderErrorUserFriendly; | ||
}; | ||
|
||
/** | ||
* FileFormat - abstract class for parsing files | ||
*/ | ||
|
@@ -67,6 +81,7 @@ class FileFormat : public retdec::utils::ByteValueStorage, private retdec::utils | |
PdbInfo *pdbInfo; ///< information about related PDB debug file | ||
CertificateTable *certificateTable; ///< table of certificates | ||
Format fileFormat; ///< format of input file | ||
LoaderErrorInfo _ldrErrInfo; ///< loader error (e.g. Windows loader error for PE files) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There are tabs in-between name of the attribute and comment. Please use spaces here. We use tabs only for indentation. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed in commit cab9451 |
||
bool stateIsValid; ///< internal state of instance | ||
std::vector<std::pair<std::size_t, std::size_t>> secHashInfo; ///< information for calculation of section table hash | ||
retdec::utils::Maybe<bool> signatureVerified; ///< indicates whether the signature is present and also verified | ||
|
@@ -128,7 +143,9 @@ class FileFormat : public retdec::utils::ByteValueStorage, private retdec::utils | |
virtual std::size_t getByteLength() const override; | ||
virtual std::size_t getWordLength() const override; | ||
virtual std::size_t getNumberOfNibblesInByte() const override; | ||
|
||
/// @} | ||
const LoaderErrorInfo & getLoaderErrorInfo() const; | ||
|
||
/// @name Detection methods | ||
/// @{ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,7 +37,7 @@ class FileInformation | |
std::string endianness; ///< endianness | ||
std::string manifest; ///< XML manifest | ||
std::string compactManifest; ///< compact version of XML manifest | ||
FileHeader header; ///< file header | ||
FileHeader header; ///< file header | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Spaces. |
||
RichHeader richHeader; ///< rich header | ||
PdbInfo pdbInfo; ///< information about related PDB file | ||
ImportTable importTable; ///< information about imports | ||
|
@@ -55,7 +55,7 @@ class FileInformation | |
std::vector<Pattern> malwarePatterns; ///< detected malware patterns | ||
std::vector<Pattern> otherPatterns; ///< other detected patterns | ||
Strings strings; ///< detected strings | ||
retdec::utils::Maybe<bool> signatureVerified; ///< indicates whether the signature is present and if it is verified | ||
retdec::utils::Maybe<bool> signatureVerified; ///< indicates whether the signature is present and if it is verified | ||
DotnetInfo dotnetInfo; ///< .NET information | ||
public: | ||
retdec::cpdetect::ToolInformation toolInfo; ///< detected tools | ||
|
@@ -400,7 +400,8 @@ class FileInformation | |
std::string getNumberOfLoadedSegmentsStr(std::ios_base &(* format)(std::ios_base &)) const; | ||
const LoadedSegment& getLoadedSegment(std::size_t index) const; | ||
const std::string& getLoaderStatusMessage() const; | ||
/// @} | ||
const retdec::fileformat::LoaderErrorInfo & getLoaderErrorInfo() const; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Spaces. |
||
/// @} | ||
|
||
/// @name Getters of @a dotnetInfo | ||
/// @{ | ||
|
@@ -492,6 +493,7 @@ class FileInformation | |
void setSignatureVerified(bool verified); | ||
void setLoadedBaseAddress(unsigned long long baseAddress); | ||
void setLoaderStatusMessage(const std::string& statusMessage); | ||
void setLoaderErrorInfo(const retdec::fileformat::LoaderErrorInfo & ldrErrInfo); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Spaces. |
||
void setDotnetUsed(bool set); | ||
void setDotnetRuntimeVersion(std::uint64_t majorVersion, std::uint64_t minorVersion); | ||
void setDotnetMetadataHeaderAddress(std::uint64_t address); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,7 +37,9 @@ class LoaderInfo | |
unsigned long long _baseAddress; | ||
std::vector<LoadedSegment> _loadedSegments; | ||
std::string _statusMessage; | ||
public: | ||
retdec::fileformat::LoaderErrorInfo _ldrErrInfo; | ||
|
||
public: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Missing 1 TAB. |
||
LoaderInfo(); | ||
~LoaderInfo(); | ||
|
||
|
@@ -48,12 +50,14 @@ class LoaderInfo | |
unsigned long long getNumberOfLoadedSegments() const; | ||
const LoadedSegment& getLoadedSegment(unsigned long long index) const; | ||
const std::string& getStatusMessage() const; | ||
const retdec::fileformat::LoaderErrorInfo & getLoaderErrorInfo() const; | ||
/// @} | ||
|
||
/// @name Setters | ||
/// @{ | ||
void setBaseAddress(unsigned long long baseAddress); | ||
void setStatusMessage(const std::string& statusMessage); | ||
void setLoaderErrorInfo(const retdec::fileformat::LoaderErrorInfo & ldrErrInfo); | ||
/// @} | ||
|
||
/// @name Other methods | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please, remove these lines which are commented out. Also please add
URL_HASH
with the hash of the new archive so CMake can check whether it downloaded correct archive.