Fix uninitialized variable use in arc disassembler

Fix invalid malloc in generic disasm
This commit is contained in:
pancake 2012-09-23 18:10:37 +02:00
parent 83cfbb2236
commit d00cc922fb
7 changed files with 7 additions and 2 deletions

View File

@ -540,7 +540,7 @@ dsmOneArcInst (bfd_vma addr, struct arcDisState * state)
int is_linked = 0;
int offset = 0;
int usesAuxReg = 0;
int flags;
int flags = 0;
int ignoreFirstOpd;
char formatString[60];

View File

@ -77,6 +77,7 @@ struct arcDisState
unsigned char tcnt;
unsigned char acnt;
};
int decodeInstr (bfd_vma address, disassemble_info * info);
#define __TRANSLATION_REQUIRED(state) ((state).acnt != 0)

View File

@ -21,6 +21,7 @@
#include "sysdep.h"
#include <stdio.h>
#include <string.h>
#include "ansidecl.h"
//#include "bfd.h"
#include "arc.h"

View File

@ -1,7 +1,6 @@
/* radare - LGPL - Copyright 2009-2012 - nibble */
#include <stdio.h>
#include <r_types.h>
#include <r_util.h>
#include <r_asm.h>
@ -286,6 +285,7 @@ R_API int r_asm_disassemble(RAsm *a, RAsmOp *op, const ut8 *buf, ut64 len) {
ret = a->cur->disassemble (a, op, buf, len);
if (ret > 0) {
int oplen = r_asm_op_get_size (op);
if (oplen>len) oplen = len;
if (a->ofilter)
r_parse_parse (a->ofilter, op->buf_asm, op->buf_asm);
else memcpy (op->buf, buf, oplen);

View File

@ -47,6 +47,7 @@ static int buf_fprintf(void *stream, const char *format, ...) {
return 0;
}
int decodeInstr (bfd_vma address, disassemble_info * info);
static int disassemble(RAsm *a, struct r_asm_op_t *op, const ut8 *buf, ut64 len) {
static struct disassemble_info disasm_obj;
if (len<4) return -1;

View File

@ -654,6 +654,7 @@ toro:
free (buf);
if (idx>=len) {// && (invbreak && !lastfail)) {
if (invbreak && lines<l) {
if (len<4) len = 4;
buf = nbuf = malloc (len);
addr += idx;
r_core_read_at (core, addr, buf, len);

View File

@ -444,6 +444,7 @@ R_API int r_core_visual_cmd(RCore *core, int ch) {
{
int offscreen = (core->cons->rows-3)*cols;
if (cursor>=offscreen) {
ut64 x = core->offset + cols;
r_core_seek (core, core->offset+cols, 1);
cursor-=cols;
}