forked from googleprojectzero/functionsimsearch
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfunctionmetadata.hpp
32 lines (26 loc) · 1.08 KB
/
functionmetadata.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#ifndef FUNCTIONMETADATA_HPP
#define FUNCTIONMETADATA_HPP
#include <map>
#include <string>
#include <vector>
// A class that provides metainformation about a given function.
// Reads and parses a CSV file with the following fields:
//
// FileID FileName FunctionAddress FunctionName IsVulnerable
class FunctionMetadataStore {
public:
FunctionMetadataStore(const std::string& csvfile);
bool GetFunctionName(uint64_t file_id, uint64_t address, std::string* out);
bool GetFileName(uint64_t file_id, std::string* out);
bool FunctionHasVulnerability(uint64_t file_id, uint64_t address);
void AddFunctionName(uint64_t file_id, uint64_t address, const std::string&
function_name);
void SetFunctionIsVulnerable(uint64_t file_id, uint64_t address, bool val);
void AddFileName(uint64_t file_id, const std::string& file_name);
private:
std::map<uint64_t, std::string> file_id_to_name_;
std::map<std::pair<uint64_t, uint64_t>, std::string> function_to_name_;
std::map<std::pair<uint64_t, uint64_t>, bool> function_to_vuln_;
std::string csvfile_name_;
};
#endif // FUNCTIONMETADATA_HPP