diff options
-rw-r--r-- | ChangeLog | 9 | ||||
-rw-r--r-- | plugins/readdex/ids.c | 19 | ||||
-rw-r--r-- | plugins/readelf/strtab.c | 2 | ||||
-rw-r--r-- | src/format/elf/strings.c | 2 |
4 files changed, 24 insertions, 8 deletions
@@ -1,5 +1,14 @@ 17-08-27 Cyrille Bagard <nocbos@gmail.com> + * plugins/readdex/ids.c: + Take into account that some instruction creations may fail. + + * plugins/readelf/strtab.c: + * src/format/elf/strings.c: + Assert some functions do not fail. + +17-08-27 Cyrille Bagard <nocbos@gmail.com> + * src/gui/dialogs/about.c: Replace a deprecated function in the About box. 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); diff --git a/src/format/elf/strings.c b/src/format/elf/strings.c index e885632..2af08b2 100644 --- a/src/format/elf/strings.c +++ b/src/format/elf/strings.c @@ -24,6 +24,7 @@ #include "strings.h" +#include <assert.h> #include <ctype.h> #include <malloc.h> #include <string.h> @@ -201,6 +202,7 @@ static bool parse_elf_string_data(GElfFormat *format, phys_t start, phys_t size, init_vmpa(&pos, start + i, address + i); instr = g_raw_instruction_new_array(content, MDS_8_BITS, end - i, &pos, format->endian); + assert(instr != NULL); g_raw_instruction_mark_as_string(G_RAW_INSTRUCTION(instr), true); |