From 355a7140932b77d351bc6ddd965608b0011af855 Mon Sep 17 00:00:00 2001 From: Cyrille Bagard Date: Wed, 11 Nov 2015 23:05:36 +0000 Subject: Fixed most of the warnings about use of uninitialized data. git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@607 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a --- ChangeLog | 16 ++++++++++++++++ plugins/ropgadgets/select.c | 6 ++++-- src/analysis/binary.c | 4 ++-- src/analysis/db/server.c | 3 ++- src/analysis/disass/area.c | 3 +++ src/analysis/disass/disassembler.c | 4 ++-- src/format/dex/pool.c | 2 ++ src/format/java/java-int.c | 2 ++ src/format/java/pool.c | 8 ++++---- src/format/mangling/itanium/abi.c | 2 ++ src/format/mangling/itanium/component.c | 3 +++ src/gtkext/easygtk.c | 8 +++++++- src/gtkext/gtkbufferview.c | 2 ++ 13 files changed, 51 insertions(+), 12 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8ff7f0b..d67f749 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,19 @@ +15-11-12 Cyrille Bagard + + * plugins/ropgadgets/select.c: + * src/analysis/binary.c: + * src/analysis/db/server.c: + * src/analysis/disass/area.c: + * src/analysis/disass/disassembler.c: + * src/format/dex/pool.c: + * src/format/java/java-int.c: + * src/format/java/pool.c: + * src/format/mangling/itanium/abi.c: + * src/format/mangling/itanium/component.c: + * src/gtkext/easygtk.c: + * src/gtkext/gtkbufferview.c: + Fix most of the warnings about use of uninitialized data. + 15-11-11 Cyrille Bagard * src/analysis/disass/disassembler.c: diff --git a/plugins/ropgadgets/select.c b/plugins/ropgadgets/select.c index 3ce04de..97ffc5d 100644 --- a/plugins/ropgadgets/select.c +++ b/plugins/ropgadgets/select.c @@ -1428,10 +1428,10 @@ static gpointer look_for_rop_gadgets(GObject *ref) push_dyn_status_printing_of_rop_search_step(ref, "final", msg, count > 0); - lfrg_unlock: - push_found_rop_gadgets(ref, format, list, count); + lfrg_unlock: + return NULL; } @@ -1782,6 +1782,8 @@ static void add_new_gadgets_for_category(GBinFormat *format, GtkComboBoxText *co { /* Parcours des différentes lignes */ + raw_virtual = NULL; + virtual = NULL; content_raw = NULL; content_markup = NULL; diff --git a/src/analysis/binary.c b/src/analysis/binary.c index ae8054b..5884350 100644 --- a/src/analysis/binary.c +++ b/src/analysis/binary.c @@ -1107,7 +1107,7 @@ bool _g_loaded_binary_add_to_collection(GLoadedBinary *binary, DBFeatures featur /* S'il n'y a pas besoin de sauvegarde... */ if (g_db_item_is_volatile(item)) - _g_db_collection_add_item(collec, item, lock); + result = _g_db_collection_add_item(collec, item, lock); /* Sinon on envoie par le réseau ! */ else @@ -1167,7 +1167,7 @@ bool _g_loaded_binary_remove_from_collection(GLoadedBinary *binary, DBFeatures f /* S'il n'y a pas besoin de sauvegarde... */ if (g_db_item_is_volatile(item)) - _g_db_collection_remove_item(collec, item, lock); + result = _g_db_collection_remove_item(collec, item, lock); /* Sinon on envoie par le réseau ! */ else diff --git a/src/analysis/db/server.c b/src/analysis/db/server.c index 3ef1ce0..3107231 100644 --- a/src/analysis/db/server.c +++ b/src/analysis/db/server.c @@ -249,12 +249,12 @@ static void *g_db_server_listener(GDbServer *server) char source[INET6_ADDRSTRLEN]; /* Adresse du client (IPv4/6) */ const char *ip; /* Statut de la conversion */ DBError error; /* Validation de la connexion */ + GCdbArchive *archive; /* Destinataire final du client*/ uint32_t cmd; /* Commande initiale lue */ uint32_t version; /* Version du client lue */ rle_string hash; /* Empreinte du binaire visé */ rle_string user; /* Nom d'utilisateur du client */ GList *iter; /* Boucle de parcours */ - GCdbArchive *archive; /* Destinataire final du client*/ fds.fd = server->fd; fds.events = POLLIN | POLLPRI; @@ -285,6 +285,7 @@ static void *g_db_server_listener(GDbServer *server) } error = DBE_NONE; + archive = NULL; /** * Le premier "paquet" reçu de la part d'un client doit contenir les informations suivantes : diff --git a/src/analysis/disass/area.c b/src/analysis/disass/area.c index de2c742..1d841be 100644 --- a/src/analysis/disass/area.c +++ b/src/analysis/disass/area.c @@ -1188,6 +1188,9 @@ mem_area *compute_memory_areas(GExeFormat *format, phys_t bin_length, size_t *co { /* Sélection et écartement des symboles */ + range = NULL; /* Pour GCC */ + length = 0; /* Pour GCC */ + for (; j < sym_count; j++) { type = g_binary_symbol_get_target_type(symbols[j]); diff --git a/src/analysis/disass/disassembler.c b/src/analysis/disass/disassembler.c index 2f9d293..ce49aca 100644 --- a/src/analysis/disass/disassembler.c +++ b/src/analysis/disass/disassembler.c @@ -328,13 +328,13 @@ static void g_delayed_disassembly_process(GDelayedDisassembly *disass, GtkExtSta - //id = gtk_extended_status_bar_push(statusbar, _("Finding remaining limits..."), true); + id = gtk_extended_status_bar_push(statusbar, _("Finding remaining limits..."), true); //qsort(routines, routines_count, sizeof(GBinRoutine *), (__compar_fn_t)g_binary_routine_rcompare); limit_all_routines(disass->format, proc, routines, routines_count, statusbar, id); - //gtk_extended_status_bar_remove(statusbar, id); + gtk_extended_status_bar_remove(statusbar, id); //run_plugins_on_binary(disass->binary, PGA_BINARY_BOUNDED, true); diff --git a/src/format/dex/pool.c b/src/format/dex/pool.c index 904ab76..1724dd9 100644 --- a/src/format/dex/pool.c +++ b/src/format/dex/pool.c @@ -403,6 +403,8 @@ GBinRoutine *get_prototype_from_dex_pool(GDexFormat *format, uint32_t index) uint32_t i; /* Boucle de parcours */ GBinVariable *arg; /* Argument reconstitué */ + result = NULL; + if (index >= format->header.method_ids_size) goto grfdp_error; diff --git a/src/format/java/java-int.c b/src/format/java/java-int.c index a201d50..6b08a95 100644 --- a/src/format/java/java-int.c +++ b/src/format/java/java-int.c @@ -51,6 +51,8 @@ bool read_java_header(const GJavaFormat *format, off_t *pos, java_header *header uint32_t magic; /* Identifiant Java */ size_t i; /* Boucle de parcours */ + result = true; + content = NULL; //G_BIN_FORMAT(format)->content; length = 0; //G_BIN_FORMAT(format)->length; diff --git a/src/format/java/pool.c b/src/format/java/pool.c index f23cd41..7382f5f 100755 --- a/src/format/java/pool.c +++ b/src/format/java/pool.c @@ -63,7 +63,7 @@ bool load_java_pool(GJavaFormat *format, off_t *pos) result = false/*read_u16(&count, G_BIN_FORMAT(format)->content, pos, G_BIN_FORMAT(format)->length, SRE_BIG)*/; - +#if 0 printf("Alloc %hu entries (result=%d)\n", count, result); format->header.pool_len = count - 1; @@ -85,7 +85,7 @@ bool load_java_pool(GJavaFormat *format, off_t *pos) } } - +#endif return result; } @@ -163,9 +163,9 @@ bool load_java_pool_entry(GJavaFormat *format, constant_pool_entry *entry, off_t result = false/*read_u8(&tag, G_BIN_FORMAT(format)->content, pos, G_BIN_FORMAT(format)->length, SRE_BIG)*/; - - entry->tag = tag; #if 0 + entry->tag = tag; + switch (entry->tag) { case CONSTANT_CLASS: diff --git a/src/format/mangling/itanium/abi.c b/src/format/mangling/itanium/abi.c index f02d4cc..b9c3dfa 100644 --- a/src/format/mangling/itanium/abi.c +++ b/src/format/mangling/itanium/abi.c @@ -2271,6 +2271,8 @@ static itanium_component *itd_expr_primary(GItaniumDContext *context) itd_unref_comp(type); } + else + result = NULL; /* Règle */ diff --git a/src/format/mangling/itanium/component.c b/src/format/mangling/itanium/component.c index def9a38..d147ba8 100644 --- a/src/format/mangling/itanium/component.c +++ b/src/format/mangling/itanium/component.c @@ -593,6 +593,9 @@ char *itd_translate_component(GItaniumDContext *context, const itanium_component case IOT_VENDOR: result = stradd(base, "TODO_VENDOR"); break; + default: + result = NULL; + break; } break; diff --git a/src/gtkext/easygtk.c b/src/gtkext/easygtk.c index 5348265..d6a1c73 100644 --- a/src/gtkext/easygtk.c +++ b/src/gtkext/easygtk.c @@ -24,6 +24,9 @@ #include "easygtk.h" +#include + + #include "support.h" @@ -467,9 +470,12 @@ static void _finish_button_with_img(GtkWidget *button, GObject *object, const ch else if (picture != NULL) gtk_container_add(GTK_CONTAINER(button), picture); - else /*if (label != NULL)*/ + else if (label != NULL) gtk_container_add(GTK_CONTAINER(button), caption); + else + assert(0); + /* Interactions GTK... */ if (G_IS_OBJECT(object) && name != NULL) diff --git a/src/gtkext/gtkbufferview.c b/src/gtkext/gtkbufferview.c index 2884383..0d11de2 100644 --- a/src/gtkext/gtkbufferview.c +++ b/src/gtkext/gtkbufferview.c @@ -595,6 +595,8 @@ static gboolean gtk_buffer_view_query_tooltip(GtkWidget *widget, gint x, gint y, if (g_binary_format_find_next_symbol_at(format, &addr, &next_sym)) stop_addr = get_mrange_addr(g_binary_symbol_get_range(next_sym)); + else + stop_addr = NULL; /* Pour GCC */ g_generic_config_get_value(get_main_configuration(), MPK_TOOLTIP_SIZE, &count); -- cgit v0.11.2-87-g4458