summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--disasm/dumpobject.cpp3
-rw-r--r--disasm/extractfunction.cpp2
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(