diff options
| author | Dennis Brentjes <d.brentjes@gmail.com> | 2016-09-10 20:42:47 +0200 |
|---|---|---|
| committer | Dennis Brentjes <d.brentjes@gmail.com> | 2016-09-10 20:42:47 +0200 |
| commit | 0ce4a59418937e562b4830b1b0654d0a4887addb (patch) | |
| tree | 608e46989a23ad1ee32736497b8aa6d68116e18e | |
| parent | f69d884353a23986ee40b108997ba155235d7529 (diff) | |
| download | openwar-0ce4a59418937e562b4830b1b0654d0a4887addb.tar.gz openwar-0ce4a59418937e562b4830b1b0654d0a4887addb.tar.bz2 openwar-0ce4a59418937e562b4830b1b0654d0a4887addb.zip | |
Reserves less, but enough room when using the old distorm interface.
| -rw-r--r-- | disasm/dumpobject.cpp | 3 | ||||
| -rw-r--r-- | disasm/extractfunction.cpp | 2 |
2 files changed, 3 insertions, 2 deletions
diff --git a/disasm/dumpobject.cpp b/disasm/dumpobject.cpp index ae09b12..f71208c 100644 --- a/disasm/dumpobject.cpp +++ b/disasm/dumpobject.cpp @@ -13,10 +13,11 @@ void dump_object(std::string file_name, binparse::Value32 object_id) auto file = parse_file(ifs); std::vector<_DecodedInst> instructions; - instructions.resize(100000); + unsigned int read_inst; std::vector<uint8_t> code = read_object(ifs, file, object_id); + instructions.resize(code.size()); auto result = distorm_decode64( file.object_table.entries[object_id].reloc_base_address, diff --git a/disasm/extractfunction.cpp b/disasm/extractfunction.cpp index 1af481e..ce54240 100644 --- a/disasm/extractfunction.cpp +++ b/disasm/extractfunction.cpp @@ -107,7 +107,7 @@ void extract_function(std::string file_path, binparse::Value32 object_id, binpar std::cout << "Function ends at: " << binparse::Offset32(ci.nextOffset) << std::endl; std::vector<_DecodedInst> instructions; - instructions.resize(100000); + instructions.resize(ci.nextOffset - function_offset); unsigned int read_inst; auto result = distorm_decode64( |
