From 1991abdadab865243168c4ff8f744e07110a01ad Mon Sep 17 00:00:00 2001 From: Cyrille Bagard Date: Mon, 22 Feb 2010 23:49:58 +0000 Subject: Avoided crashes when loading unrecognized files. git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@142 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a --- src/analysis/binary.c | 10 +++++++++- src/gtkext/gtkblockview.c | 6 ++++++ 2 files changed, 15 insertions(+), 1 deletion(-) 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); diff --git a/src/gtkext/gtkblockview.c b/src/gtkext/gtkblockview.c index ae4b1a8..a4f0d3e 100644 --- a/src/gtkext/gtkblockview.c +++ b/src/gtkext/gtkblockview.c @@ -318,6 +318,8 @@ static void g_delayed_insertion_process(GDelayedInsertion *insertion, GtkExtStat lines = GTK_BIN_VIEW(view)->lines; last = GTK_BIN_VIEW(view)->last; + if (lines == NULL) return; + iter = g_rendering_line_loop_for_code(lines, last); start = get_rendering_line_address(lines); @@ -867,6 +869,8 @@ static gboolean gtk_block_view_expose(GtkWidget *widget, GdkEventExpose *event) mark = gtk_text_iter_get_marks(&iter)->data; line = g_object_get_data(G_OBJECT(mark), "line"); + if (line == NULL) break; + flags = g_rendering_line_get_flags(line); if (flags & RLF_RUNNING_BP) @@ -1081,6 +1085,8 @@ static void gtk_block_view_complete_building_content(GDelayedInsertion *insertio gtk_text_layout_set_buffer(view->layout, view->buffer); + gtk_text_layout_set_cursor_visible(GTK_BLOCK_VIEW(view)->layout, FALSE); + gtk_text_buffer_get_end_iter(view->buffer, &pos); gtk_text_layout_move_iter_visually(view->layout, &pos, -1); gtk_text_layout_get_iter_location(view->layout, &pos, &rect); -- cgit v0.11.2-87-g4458