summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2017-08-27 18:14:19 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2017-08-27 18:14:19 (GMT)
commitdbb5a81c38ccbdefafc2abe3bd1e266a7fc42bc2 (patch)
treede1b90292e08154d26d4b58cb896d6d7be534b1f /plugins
parent47480a98d3c5c058755f3206765730dbfbf3ecef (diff)
Took into account that some instruction creations may fail.
Diffstat (limited to 'plugins')
-rw-r--r--plugins/readdex/ids.c19
-rw-r--r--plugins/readelf/strtab.c2
2 files changed, 13 insertions, 8 deletions
diff --git a/plugins/readdex/ids.c b/plugins/readdex/ids.c
index 518e9ad..88a60b0 100644
--- a/plugins/readdex/ids.c
+++ b/plugins/readdex/ids.c
@@ -24,7 +24,6 @@
#include "ids.h"
-#include <assert.h>
#include <malloc.h>
#include <stdio.h>
@@ -330,16 +329,20 @@ bool annotate_dex_string_ids(const GDexFormat *format, GPreloadInfo *info, GtkSt
{
instr = g_raw_instruction_new_array(content, MDS_8_BITS, length, &item_pos, endian);
- g_raw_instruction_mark_as_string(G_RAW_INSTRUCTION(instr), true);
+ if (instr != NULL)
+ {
+ g_raw_instruction_mark_as_string(G_RAW_INSTRUCTION(instr), true);
- inserted = g_preload_info_add_instruction(info, instr);
+ inserted = g_preload_info_add_instruction(info, instr);
- if (inserted)
- {
- range = g_arch_instruction_get_range(instr);
+ if (inserted)
+ {
+ range = g_arch_instruction_get_range(instr);
+
+ symbol = g_binary_symbol_new(range, STP_RO_STRING);
+ g_binary_format_add_symbol(bformat, symbol);
- symbol = g_binary_symbol_new(range, STP_RO_STRING);
- g_binary_format_add_symbol(bformat, symbol);
+ }
}
diff --git a/plugins/readelf/strtab.c b/plugins/readelf/strtab.c
index 7cdb4c9..dc022cf 100644
--- a/plugins/readelf/strtab.c
+++ b/plugins/readelf/strtab.c
@@ -24,6 +24,7 @@
#include "strtab.h"
+#include <assert.h>
#include <ctype.h>
@@ -101,6 +102,7 @@ static void parse_elf_string_table(GElfFormat *format, GPreloadInfo *info, const
advance_vmpa(&pos, i);
instr = g_raw_instruction_new_array(content, MDS_8_BITS, end - i, &pos, MDS_UNDEFINED);
+ assert(instr != NULL);
g_raw_instruction_mark_as_string(G_RAW_INSTRUCTION(instr), true);