diff --git a/src/google_breakpad/processor/stack_frame.h b/src/google_breakpad/processor/stack_frame.h index a47c621f..c4449938 100644 --- a/src/google_breakpad/processor/stack_frame.h +++ b/src/google_breakpad/processor/stack_frame.h @@ -68,8 +68,6 @@ struct StackFrame { // by the stackwalker. string trust_description() const { switch (trust) { - case StackFrame::FRAME_TRUST_NONE: - return "unknown"; case StackFrame::FRAME_TRUST_CONTEXT: return "given as instruction pointer in context"; case StackFrame::FRAME_TRUST_CFI: @@ -80,6 +78,8 @@ struct StackFrame { return "previous frame's frame pointer"; case StackFrame::FRAME_TRUST_SCAN: return "stack scanning"; + default: + return "unknown"; } }; diff --git a/src/processor/disassembler_x86.cc b/src/processor/disassembler_x86.cc index 5caa016f..31af24fc 100644 --- a/src/processor/disassembler_x86.cc +++ b/src/processor/disassembler_x86.cc @@ -108,6 +108,8 @@ u_int32_t DisassemblerX86::NextInstruction() { } } break; + default: + break; } break; @@ -160,6 +162,8 @@ u_int32_t DisassemblerX86::NextInstruction() { if (dest->data.reg.id == bad_register_.id) pushed_bad_value_ = true; break; + default: + break; } } @@ -195,6 +199,8 @@ u_int32_t DisassemblerX86::NextInstruction() { memcpy(&bad_register_, &dest->data.reg, sizeof(libdis::x86_reg_t)); } break; + default: + break; } } diff --git a/src/processor/exploitability_win.cc b/src/processor/exploitability_win.cc index 9837b791..443635fb 100644 --- a/src/processor/exploitability_win.cc +++ b/src/processor/exploitability_win.cc @@ -100,7 +100,6 @@ ExploitabilityRating ExploitabilityWin::CheckPlatformExploitability() { } u_int64_t address = process_state_->crash_address(); u_int32_t exception_code = raw_exception->exception_record.exception_code; - u_int32_t exception_flags = raw_exception->exception_record.exception_flags; u_int32_t exploitability_weight = 0; @@ -239,6 +238,8 @@ ExploitabilityRating ExploitabilityWin::CheckPlatformExploitability() { case libdis::insn_string: exploitability_weight += kHugeBump; break; + default: + break; } // Loop the disassembler through the code and check if it // IDed any interesting conditions in the near future. diff --git a/src/third_party/libdisasm/x86_format.c b/src/third_party/libdisasm/x86_format.c index b5b47e30..aed8cce4 100644 --- a/src/third_party/libdisasm/x86_format.c +++ b/src/third_party/libdisasm/x86_format.c @@ -46,7 +46,7 @@ } \ } while( 0 ) -static char *prefix_strings[] = { +static const char *prefix_strings[] = { "", /* no prefix */ "repz ", /* the trailing spaces make it easy to prepend to mnemonic */ "repnz ", @@ -115,7 +115,7 @@ static void get_operand_data_str( x86_op_t *op, char *str, int len ){ static void get_operand_regtype_str( int regtype, char *str, int len ) { static struct { - char *name; + const char *name; int value; } operand_regtypes[] = { {"reg_gen" , 0x00001}, @@ -285,7 +285,7 @@ static int format_expr( x86_ea_t *ea, char *buf, int len, static int format_seg( x86_op_t *op, char *buf, int len, enum x86_asm_format format ) { int len_orig = len; - char *reg = ""; + const char *reg = ""; if (! op || ! buf || ! len || ! op->flags) { return(0); @@ -293,7 +293,7 @@ static int format_seg( x86_op_t *op, char *buf, int len, if ( op->type != op_offset && op->type != op_expression ){ return(0); } - if (! (int) op->flags & 0xF00 ) { + if (! ((int) op->flags & 0xF00) ) { return(0); } @@ -329,9 +329,9 @@ static int format_seg( x86_op_t *op, char *buf, int len, return( len_orig - len ); /* return length of appended string */ } -static char *get_operand_datatype_str( x86_op_t *op ){ +static const char *get_operand_datatype_str( x86_op_t *op ){ - static char *types[] = { + static const char *types[] = { "sbyte", /* 0 */ "sword", "sqword", @@ -406,7 +406,7 @@ static int format_insn_eflags_str( enum x86_flag_status flags, char *buf, int len) { static struct { - char *name; + const char *name; int value; } insn_flags[] = { { "carry_set ", 0x0001 }, @@ -441,9 +441,9 @@ static int format_insn_eflags_str( enum x86_flag_status flags, char *buf, return( len_orig - len ); } -static char *get_insn_group_str( enum x86_insn_group gp ) { +static const char *get_insn_group_str( enum x86_insn_group gp ) { - static char *types[] = { + static const char *types[] = { "", // 0 "controlflow",// 1 "arithmetic", // 2 @@ -468,10 +468,10 @@ static char *get_insn_group_str( enum x86_insn_group gp ) { return types[gp]; } -static char *get_insn_type_str( enum x86_insn_type type ) { +static const char *get_insn_type_str( enum x86_insn_type type ) { static struct { - char *name; + const char *name; int value; } types[] = { /* insn_controlflow */ @@ -593,8 +593,8 @@ static char *get_insn_type_str( enum x86_insn_type type ) { return ""; } -static char *get_insn_cpu_str( enum x86_insn_cpu cpu ) { - static char *intel[] = { +static const char *get_insn_cpu_str( enum x86_insn_cpu cpu ) { + static const char *intel[] = { "", // 0 "8086", // 1 "80286", // 2 @@ -621,8 +621,8 @@ static char *get_insn_cpu_str( enum x86_insn_cpu cpu ) { return ""; } -static char *get_insn_isa_str( enum x86_insn_isa isa ) { - static char *subset[] = { +static const char *get_insn_isa_str( enum x86_insn_isa isa ) { + static const char *subset[] = { NULL, // 0 "General Purpose", // 1 "Floating Point", // 2 @@ -885,7 +885,7 @@ static int format_operand_raw( x86_op_t *op, x86_insn_t *insn, char *buf, int len){ char str[MAX_OP_RAW_STRING]; - char *datatype = get_operand_datatype_str(op); + const char *datatype = get_operand_datatype_str(op); switch (op->type) { case op_register: @@ -1016,7 +1016,7 @@ int x86_format_operand( x86_op_t *op, char *buf, int len, static int format_att_mnemonic( x86_insn_t *insn, char *buf, int len) { int size = 0; - char *suffix; + const char *suffix; if (! insn || ! buf || ! len ) return(0);