diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2010-02-22 23:49:58 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2010-02-22 23:49:58 (GMT) |
commit | 1991abdadab865243168c4ff8f744e07110a01ad (patch) | |
tree | 491467251278baf4e6729d54c61c068e81d45196 /src/analysis | |
parent | 2d95ce74200c8cb7c328535235a8c8e74686794e (diff) |
Avoided crashes when loading unrecognized files.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@142 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'src/analysis')
-rw-r--r-- | src/analysis/binary.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/analysis/binary.c b/src/analysis/binary.c index 58979d0..2b392bd 100644 --- a/src/analysis/binary.c +++ b/src/analysis/binary.c @@ -705,13 +705,19 @@ GOpenidaBinary *g_openida_binary_new_from_file(const char *filename) result = g_object_new(G_TYPE_OPENIDA_BINARY, NULL); + log_variadic_message(LMT_PROCESS, _("Opening '%s' file..."), filename); + result->filename = strdup(filename); result->bin_data = map_binary_file(filename, &result->bin_length); if (result->bin_data == NULL) goto lbf_error; result->format = G_EXE_FORMAT(load_new_format(FMT_EXEC, result->bin_data, result->bin_length)); - if (result->format == NULL) goto lbf_error; + if (result->format == NULL) + { + log_simple_message(LMT_INFO, _("Unknown binary format")); + goto lbf_error; + } switch (g_exe_format_get_target_machine(result->format)) { @@ -795,6 +801,8 @@ GOpenidaBinary *g_openida_binary_new_from_xml(xmlXPathContextPtr context, const free(filename); } + if (result == NULL) return NULL; + /* Parties à désassembler : default */ access = strdup(path); |