summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--plugins/arm/instruction.c7
-rw-r--r--plugins/arm/v7/processor.c5
-rw-r--r--plugins/elf/symbols.c12
-rw-r--r--plugins/pychrysalide/arch/immediate.c9
-rw-r--r--src/analysis/binary.c1
-rw-r--r--src/analysis/db/certs.c2
-rw-r--r--src/analysis/db/item.c6
-rw-r--r--src/analysis/db/misc/rlestr.c3
-rw-r--r--src/analysis/db/server.c24
-rw-r--r--src/analysis/disass/output.c5
-rw-r--r--src/arch/post.c1
-rw-r--r--src/arch/raw.c6
-rw-r--r--src/arch/undefined.c1
-rwxr-xr-xsrc/common/endianness.c3
-rw-r--r--src/debug/break.c2
-rw-r--r--src/debug/gdbrsp/utils.c5
-rw-r--r--src/format/dwarf/symbols.c2
-rw-r--r--src/glibext/gbufferline.c2
-rw-r--r--src/glibext/linesegment.c6
-rw-r--r--src/gui/dialogs/shellcode.c2
-rw-r--r--src/gui/panels/errors.c16
-rw-r--r--src/gui/panels/symbols.c5
-rw-r--r--tools/d2c/encoding.c37
-rw-r--r--tools/d2c/syntax.c6
24 files changed, 122 insertions, 46 deletions
diff --git a/plugins/arm/instruction.c b/plugins/arm/instruction.c
index 3a7af7f..ae9721a 100644
--- a/plugins/arm/instruction.c
+++ b/plugins/arm/instruction.c
@@ -24,6 +24,7 @@
#include "instruction.h"
+#include <assert.h>
#include <malloc.h>
#include <string.h>
@@ -242,6 +243,12 @@ bool g_arm_instruction_set_cond(GArmInstruction *instr, ArmCondCode cond)
case ACC_LE: suffix = "le"; break;
case ACC_AL: suffix = NULL; break;
case ACC_NV: suffix = "nv"; break;
+
+ default: /* Pour GCC... */
+ assert(false);
+ suffix = NULL;
+ break;
+
}
if (suffix != NULL)
diff --git a/plugins/arm/v7/processor.c b/plugins/arm/v7/processor.c
index 5bbe808..0203f32 100644
--- a/plugins/arm/v7/processor.c
+++ b/plugins/arm/v7/processor.c
@@ -281,8 +281,9 @@ static GArchInstruction *g_armv7_processor_disassemble(const GArmV7Processor *pr
break;
- default:
- assert(0);
+ default: /* Pour GCC... */
+ assert(false);
+ result = NULL;
break;
}
diff --git a/plugins/elf/symbols.c b/plugins/elf/symbols.c
index 315d003..8c40ae4 100644
--- a/plugins/elf/symbols.c
+++ b/plugins/elf/symbols.c
@@ -494,7 +494,11 @@ static bool do_elf_symbol_loading(GElfLoading *loading, GElfFormat *format, bool
case STT_OBJECT:
name = g_elf_loading_build_name(loading, index, virt, "obj_", alt_name, &addr);
- if (name == NULL) break;
+ if (name == NULL)
+ {
+ symbol = NULL;
+ break;
+ }
init_mrange(&range, &addr, ELF_SYM(format, sym, st_size));
@@ -515,7 +519,11 @@ static bool do_elf_symbol_loading(GElfLoading *loading, GElfFormat *format, bool
/* Constitution d'une routine */
name = g_elf_loading_build_name(loading, index, virt, "func_", alt_name, &addr);
- if (name == NULL) break;
+ if (name == NULL)
+ {
+ symbol = NULL;
+ break;
+ }
routine = try_to_demangle_routine(name);
symbol = G_BIN_SYMBOL(routine);
diff --git a/plugins/pychrysalide/arch/immediate.c b/plugins/pychrysalide/arch/immediate.c
index f1ec125..794571d 100644
--- a/plugins/pychrysalide/arch/immediate.c
+++ b/plugins/pychrysalide/arch/immediate.c
@@ -25,6 +25,7 @@
#include "immediate.h"
+#include <assert.h>
#include <pygobject.h>
@@ -181,6 +182,14 @@ static PyObject *py_imm_operand_get_value(PyObject *self, void *closure)
g_imm_operand_get_value(operand, size, &sval64);
result = PyLong_FromLongLong(sval64);
break;
+
+ /* Pour GCC... */
+ default:
+ assert(false);
+ result = Py_None;
+ Py_INCREF(result);
+ break;
+
}
return result;
diff --git a/src/analysis/binary.c b/src/analysis/binary.c
index 1a93470..606b753 100644
--- a/src/analysis/binary.c
+++ b/src/analysis/binary.c
@@ -1838,6 +1838,7 @@ static GtkWidget *g_loaded_binary_build_view(GLoadedBinary *binary, unsigned int
default:
assert(false);
+ display = NULL;
break;
}
diff --git a/src/analysis/db/certs.c b/src/analysis/db/certs.c
index 083ef7d..6b8037b 100644
--- a/src/analysis/db/certs.c
+++ b/src/analysis/db/certs.c
@@ -192,6 +192,8 @@ static RSA *generate_rsa_key(unsigned int bits, unsigned long e)
BIGNUM *bne; /* Autre version de l'exposant */
int ret; /* Bilan d'un appel */
+ result = NULL;
+
bne = BN_new();
if (bne == NULL)
{
diff --git a/src/analysis/db/item.c b/src/analysis/db/item.c
index d2c1652..e16ce56 100644
--- a/src/analysis/db/item.c
+++ b/src/analysis/db/item.c
@@ -117,10 +117,16 @@ static void g_db_item_class_init(GDbItemClass *klass)
static void g_db_item_init(GDbItem *item)
{
const char *author; /* Identification à diffuser */
+#ifndef NDEBUG
bool status; /* Bilan d'une obtention */
+#endif
+#ifndef NDEBUG
status = g_generic_config_get_value(get_main_configuration(), MPK_AUTHOR_NAME, &author);
assert(status);
+#else
+ g_generic_config_get_value(get_main_configuration(), MPK_AUTHOR_NAME, &author);
+#endif
set_static_rle_string(&item->author, author);
diff --git a/src/analysis/db/misc/rlestr.c b/src/analysis/db/misc/rlestr.c
index c1d2d95..43bbac4 100644
--- a/src/analysis/db/misc/rlestr.c
+++ b/src/analysis/db/misc/rlestr.c
@@ -265,8 +265,7 @@ bool unpack_rle_string(rle_string *str, packed_buffer *pbuf)
bool result; /* Bilan à retourner */
uint32_t tmp32; /* Valeur sur 32 bits */
- str->data = NULL;
- str->length = 0;
+ unset_rle_string(str);
result = extract_packed_buffer(pbuf, &tmp32, sizeof(uint32_t), true);
diff --git a/src/analysis/db/server.c b/src/analysis/db/server.c
index bbc7415..d0ce62b 100644
--- a/src/analysis/db/server.c
+++ b/src/analysis/db/server.c
@@ -552,6 +552,8 @@ static void *g_db_server_listener(GDbServer *server)
int ret; /* Bilan d'un appel */
gen_sockaddr_t peer; /* Adresse cliente */
int fd; /* Canal établi vers un client */
+ rle_string hash; /* Empreinte du binaire visé */
+ rle_string user; /* Nom d'utilisateur du client */
const char *ip; /* Statut de la conversion */
char *peer_name; /* Désignation du correspondant*/
DBError error; /* Validation de la connexion */
@@ -560,8 +562,6 @@ static void *g_db_server_listener(GDbServer *server)
bool status; /* Bilan d'une opération */
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 */
unsigned char sig[RSA_USED_SIZE]; /* Signature effectuée */
GList *iter; /* Boucle de parcours */
packed_buffer out_pbuf; /* Tampon d'émission */
@@ -587,6 +587,11 @@ static void *g_db_server_listener(GDbServer *server)
continue;
}
+ /* Initialisation à vide pour les sorties en erreur */
+
+ init_dynamic_rle_string(&hash, NULL);
+ init_dynamic_rle_string(&user, NULL);
+
/* Construction d'une représentation */
if (*((sa_family_t *)&peer) == AF_UNIX)
@@ -607,6 +612,9 @@ static void *g_db_server_listener(GDbServer *server)
}
+ else
+ goto gdsl_invalid;
+
error = DBE_NONE;
archive = NULL;
@@ -747,13 +755,13 @@ static void *g_db_server_listener(GDbServer *server)
init_packed_buffer(&out_pbuf);
status = extend_packed_buffer(&out_pbuf, (uint32_t []) { DBC_WELCOME }, sizeof(uint32_t), true);
- if (!status) goto gdsl_error;
+ if (!status) goto gdsl_out_error;
status = extend_packed_buffer(&out_pbuf, (uint32_t []) { error }, sizeof(uint32_t), true);
- if (!status) goto gdsl_error;
+ if (!status) goto gdsl_out_error;
status = send_packed_buffer(&out_pbuf, fd);
- if (!status) goto gdsl_error;
+ if (!status) goto gdsl_out_error;
exit_packed_buffer(&out_pbuf);
@@ -781,15 +789,19 @@ static void *g_db_server_listener(GDbServer *server)
assert(error != DBE_NONE);
- gdsl_error:
+ gdsl_out_error:
exit_packed_buffer(&out_pbuf);
+ gdsl_error:
+
free(peer_name);
exit_rle_string(&hash);
exit_rle_string(&user);
+ gdsl_invalid:
+
close(fd);
}
diff --git a/src/analysis/disass/output.c b/src/analysis/disass/output.c
index 19c7de9..a1c0718 100644
--- a/src/analysis/disass/output.c
+++ b/src/analysis/disass/output.c
@@ -206,10 +206,9 @@ void print_disassembled_instructions(GBufferCache *cache, GCodingLanguage *lang,
/* Début d'un nouveau symbole ? */
- if (symbol == NULL)
- compared = -1;
+ compared = -1;
- else
+ if (symbol != NULL)
{
iaddr = get_mrange_addr(g_arch_instruction_get_range(instr));
diff --git a/src/arch/post.c b/src/arch/post.c
index f3d1fd6..6462984 100644
--- a/src/arch/post.c
+++ b/src/arch/post.c
@@ -105,6 +105,7 @@ void post_process_target_resolution(GArchInstruction *instr, GArchProcessor *pro
default:
assert(false);
+ symbol = NULL;
break;
}
diff --git a/src/arch/raw.c b/src/arch/raw.c
index e85d865..683d60f 100644
--- a/src/arch/raw.c
+++ b/src/arch/raw.c
@@ -506,7 +506,9 @@ static void g_raw_instruction_print(GRawInstruction *instr, GBufferLine *line, s
GArchOperand *op; /* Opérande à manipuler */
GImmOperand *imm; /* Version opérande de valeur */
char byte; /* Octet à afficher (ou pas) */
+#ifndef NDEBUG
bool status; /* Bilan d'une récupération */
+#endif
base = G_ARCH_INSTRUCTION(instr);
@@ -566,8 +568,12 @@ static void g_raw_instruction_print(GRawInstruction *instr, GBufferLine *line, s
if (!instr->is_string && g_imm_operand_get_display(imm) != IOD_CHAR)
goto grip_fallback;
+#ifndef NDEBUG
status = g_imm_operand_get_value(imm, MDS_8_BITS, &byte);
assert(status);
+#else
+ g_imm_operand_get_value(imm, MDS_8_BITS, &byte);
+#endif
/* Si le caractère doit apparaître en hexadécimal... */
diff --git a/src/arch/undefined.c b/src/arch/undefined.c
index 3c76a09..0ae95d3 100644
--- a/src/arch/undefined.c
+++ b/src/arch/undefined.c
@@ -251,6 +251,7 @@ const char *g_undef_instruction_get_keyword(const GUndefInstruction *instr, AsmS
default:
assert(false);
+ result = NULL;
break;
}
diff --git a/src/common/endianness.c b/src/common/endianness.c
index 3aeca00..0304647 100755
--- a/src/common/endianness.c
+++ b/src/common/endianness.c
@@ -97,6 +97,7 @@ uint16_t swap_u16(const uint16_t *value, SourceEndian endian)
default:
assert(false);
+ result = -1;
break;
}
@@ -157,6 +158,7 @@ uint32_t swap_u32(const uint32_t *value, SourceEndian endian)
default:
assert(false);
+ result = -1;
break;
}
@@ -221,6 +223,7 @@ uint64_t swap_u64(const uint64_t *value, SourceEndian endian)
default:
assert(false);
+ result = -1;
break;
}
diff --git a/src/debug/break.c b/src/debug/break.c
index 1d4c2d3..fac3f08 100644
--- a/src/debug/break.c
+++ b/src/debug/break.c
@@ -124,6 +124,8 @@ virt_t get_raw_breakpoint_prev_addr(const raw_breakpoint *bp)
default:
+ result = VMPA_NO_VIRTUAL;
+
found = false;
for (i = 0; i < bp->count && !found; i++)
diff --git a/src/debug/gdbrsp/utils.c b/src/debug/gdbrsp/utils.c
index 8c4cb8a..f1f1c85 100644
--- a/src/debug/gdbrsp/utils.c
+++ b/src/debug/gdbrsp/utils.c
@@ -85,7 +85,7 @@ bool read_fixed_byte(const char *data, size_t len, uint8_t *byte)
len = MIN(2, len);
- for (i = 0, iter = data; i < len && result; i++, iter++)
+ for (i = 0, iter = data; i < len; i++, iter++)
{
switch (*iter)
{
@@ -107,6 +107,9 @@ bool read_fixed_byte(const char *data, size_t len, uint8_t *byte)
}
+ if (!result)
+ break;
+
if (i == 0)
*byte = (nibble << 4);
else
diff --git a/src/format/dwarf/symbols.c b/src/format/dwarf/symbols.c
index da30816..20ec7ea 100644
--- a/src/format/dwarf/symbols.c
+++ b/src/format/dwarf/symbols.c
@@ -231,7 +231,7 @@ static bool load_object_as_symbol_from_dwarf(GDwarfFormat *format, const dw_die
//printf(" --> [valid ?= %d] start @ 0x%08llx\n", status, virt);
//printf(" --> [valid ?= %d] len = 0x%08llx\n", status, len);
- printf(" --> [valid ?= %d] name = '%s'\n", status, name);
+ //printf(" --> [valid ?= %d] name = '%s'\n", status, name);
return true;
diff --git a/src/glibext/gbufferline.c b/src/glibext/gbufferline.c
index d8ed7ed..9d2ec51 100644
--- a/src/glibext/gbufferline.c
+++ b/src/glibext/gbufferline.c
@@ -1273,6 +1273,8 @@ const line_segment *g_buffer_line_get_segment_at(const GBufferLine *line, const
if (status)
result = g_buffer_line_get_segment_from_coord(line, &coord);
+ else
+ result = NULL;
return result;
diff --git a/src/glibext/linesegment.c b/src/glibext/linesegment.c
index 47ad9cc..e802dda 100644
--- a/src/glibext/linesegment.c
+++ b/src/glibext/linesegment.c
@@ -860,13 +860,13 @@ void draw_line_segment(const line_segment *segment, cairo_t *cr, gint *x, gint y
cairo_operator_t old; /* Sauvegarde avant changement */
const rendering_color_t *used_fg; /* Couleur d'impression utile */
- if (segment->text[0] == '\t' && segment->text[1] == '\0')
- goto small_sep;
-
selected = selection_list_has_segment_content(list, segment);
width = get_line_segment_width(segment);
+ if (segment->text[0] == '\t' && segment->text[1] == '\0')
+ goto small_sep;
+
/* Fond du texte */
if (selected)
{
diff --git a/src/gui/dialogs/shellcode.c b/src/gui/dialogs/shellcode.c
index 8e4a205..68ce1f4 100644
--- a/src/gui/dialogs/shellcode.c
+++ b/src/gui/dialogs/shellcode.c
@@ -192,7 +192,7 @@ static void export_assistant_close(GtkAssistant *assistant, GObject *ref)
GtkEntry *entry; /* Zone de saisie */
const gchar *filename; /* Chemin d'accès du fichier */
- //binary = G_LOADED_BINARY(g_object_get_data(ref, "binary"));
+ binary = NULL;//G_LOADED_BINARY(g_object_get_data(ref, "binary"));
format = g_loaded_binary_get_format(binary);
options = g_rendering_options_new(format);
diff --git a/src/gui/panels/errors.c b/src/gui/panels/errors.c
index afe0283..b4be9ad 100644
--- a/src/gui/panels/errors.c
+++ b/src/gui/panels/errors.c
@@ -562,6 +562,17 @@ static void update_error_panel(const GErrorPanel *panel, GtkStatusStack *status,
}
+ else
+ {
+ /* Pour GCC... */
+ format = NULL;
+ proc = NULL;
+
+ fcount = 0;
+ pcount = 0;
+
+ }
+
/* S'il n'y a aucun soucis à remonter... */
if (panel->binary == NULL || (fcount + pcount) == 0)
@@ -1026,6 +1037,11 @@ static const char *g_error_panel_setup(const GErrorPanel *panel, unsigned int ui
break;
+ default: /* Pour GCC... */
+ assert(false);
+ result = "";
+ break;
+
}
return result;
diff --git a/src/gui/panels/symbols.c b/src/gui/panels/symbols.c
index d1e60fc..f016199 100644
--- a/src/gui/panels/symbols.c
+++ b/src/gui/panels/symbols.c
@@ -1550,6 +1550,11 @@ static const char *g_symbols_panel_setup(const GSymbolsPanel *panel, unsigned in
break;
+ default: /* Pour GCC... */
+ assert(false);
+ result = "";
+ break;
+
}
/* Mémorisation de tous les noeuds ouverts */
diff --git a/tools/d2c/encoding.c b/tools/d2c/encoding.c
index 052fc04..3f0ec64 100644
--- a/tools/d2c/encoding.c
+++ b/tools/d2c/encoding.c
@@ -325,37 +325,13 @@ bool write_encoding_spec_raw_disass(const encoding_spec *spec, int fd, const cha
bool openbar; /* Syntaxe unique par défaut ? */
disass_assert *dassert; /* Eventuelles conditions */
size_t i; /* Boucle de parcours */
-
-
-
-
-
-
bool op_decl; /* Suivi des déclaration #1 */
bool imm_decl; /* Suivi des déclaration #2 */
-
bool bad_exit; /* Ajout d'une sortie d'échec ?*/
bool quick_exit; /* Inclusion de sortie rapide ?*/
-
-
-
char *encoding_fc; /* Spécification d'encodage */
char *cast; /* Conversion vers le format */
-
-
- /***************
- *
- *
- * REAL ONE
- *
- *
- *
- **********************/
-
-
-
-
result = true;
/* Détermination de la forme du code */
@@ -418,6 +394,14 @@ bool write_encoding_spec_raw_disass(const encoding_spec *spec, int fd, const cha
dprintf(fd, "\n");
+ /* Initialisation du resultat d'un point de vue global */
+
+ if (!openbar)
+ {
+ dprintf(fd, "\tresult = NULL;\n");
+ dprintf(fd, "\n");
+ }
+
/* Définition des champs bruts */
result = define_used_bits_fields(spec->bits, fd);
@@ -435,7 +419,10 @@ bool write_encoding_spec_raw_disass(const encoding_spec *spec, int fd, const cha
cast = build_cast_if_needed(encoding_fc);
- dprintf(fd, "\t%s(%s(result), \"%s\");\n", encoding_fc, cast, spec->prefix);
+ if (!openbar)
+ dprintf(fd, "\tif (result != NULL)\n");
+
+ dprintf(fd, "\t%s%s(%s(result), \"%s\");\n", openbar ? "" : "\t", encoding_fc, cast, spec->prefix);
free(cast);
diff --git a/tools/d2c/syntax.c b/tools/d2c/syntax.c
index c0842a7..de1d693 100644
--- a/tools/d2c/syntax.c
+++ b/tools/d2c/syntax.c
@@ -284,6 +284,12 @@ bool write_encoding_syntax(const encoding_syntax *syntax, int fd, const char *ar
}
+ if (!alone)
+ {
+ dprintf(fd, "\t%sassert(result == NULL);\n", tab);
+ dprintf(fd, "\n");
+ }
+
dprintf(fd, "\t%sresult = g_%s_instruction_new(\"%s\");\n",
tab, arch, get_keyword_from_asm_pattern(syntax->pattern));