Fix some warnings and add a specific plugins.cfg for emscripten

This commit is contained in:
pancake 2013-09-15 23:57:22 +02:00
parent b0c644ea8b
commit 0f2fd99986
10 changed files with 134 additions and 17 deletions

View File

@ -53,7 +53,7 @@ ut32 get_ins_part(ut32 pos, ut32 len) {
if (C55PLUS_DEBUG)
printf("pos => 0x%x len => %d ins_buff_len => %d\n", pos, len, ins_buff_len);
if (pos < 0 || pos >= ins_buff_len) {
if ((st32)pos < 0 || pos >= ins_buff_len) {
has_failed = 1;
return ret;
}

View File

@ -298,7 +298,7 @@ static int dex_loadcode(RBinArch *arch, RBinDexObj *bin) {
p = r_uleb128 (p, &MA);
p = r_uleb128 (p, &MC);
if (MI>=0&&MI<bin->header.method_size) methods[MI] = 1;
if (MI<bin->header.method_size) methods[MI] = 1;
if (MC>0 && bin->code_from>MC) bin->code_from = MC;
if (MC>0 && bin->code_to<MC) bin->code_to = MC;
@ -330,7 +330,7 @@ static int dex_loadcode(RBinArch *arch, RBinDexObj *bin) {
p = r_uleb128 (p, &MA);
p = r_uleb128 (p, &MC);
if (MI>=0&&MI<bin->header.method_size) methods[MI] = 1;
if (MI<bin->header.method_size) methods[MI] = 1;
if (bin->code_from>MC) bin->code_from = MC;
if (bin->code_to<MC) bin->code_to = MC;
@ -454,7 +454,7 @@ static RList* classes (RBinArch *arch) {
dprintf ("error malloc string length %d\n", len);
break;
}
if (entry.source_file> bin->header.strings_size || entry.source_file<0)
if ((entry.source_file>bin->header.strings_size) || (entry.source_file<0))
continue;
r_buf_read_at (bin->b, bin->strings[entry.source_file],
(ut8*)name, len);

View File

@ -589,9 +589,9 @@ static void fcn_list_bbs(RAnalFunction *fcn) {
if ((bbi->type & R_ANAL_BB_TYPE_LAST))
r_cons_printf ("l");
} else r_cons_printf ("n");
if ((bbi->diff->type == R_ANAL_DIFF_TYPE_MATCH))
if (bbi->diff->type == R_ANAL_DIFF_TYPE_MATCH)
r_cons_printf (" m");
else if ((bbi->diff->type == R_ANAL_DIFF_TYPE_UNMATCH))
else if (bbi->diff->type == R_ANAL_DIFF_TYPE_UNMATCH)
r_cons_printf (" u");
else r_cons_printf (" n");
r_cons_printf ("\n");

View File

@ -1067,7 +1067,9 @@ next2:
tmpoff = core->offset;
tmpbsz = core->blocksize;
*ptr = '\0'; for (ptr++; *ptr== ' '; ptr++); ptr--;
*ptr = '\0';
for (ptr++; *ptr== ' '; ptr++);
ptr--;
arroba = strchr (ptr+2, '@');
repeat_arroba:

View File

@ -88,7 +88,7 @@ static int cmd_meta(void *data, const char *input) {
case 'z': /* string */
{
r_core_read_at (core, addr, (ut8*)name, sizeof (name));
name[sizeof(name)] = 0;
name[sizeof(name)-1] = 0;
n = strlen (name);
eprintf ("%d\n", n);
}

View File

@ -156,7 +156,7 @@ static int r_buf_fcpy_at (RBuffer *b, ut64 addr, ut8 *buf, const char *fmt, int
if (addr == R_BUF_CUR)
addr = b->cur;
else addr -= b->base;
if (addr < 0 || addr > b->length)
if (addr == UT64_MAX || addr > b->length)
return -1;
for (i = len = 0; i < n; i++)
for (j = 0; fmt[j]; j++) {
@ -194,7 +194,7 @@ R_API ut8 *r_buf_get_at (RBuffer *b, ut64 addr, int *left) {
if (addr == R_BUF_CUR)
addr = b->cur;
else addr -= b->base;
if (addr < 0 || addr > b->length)
if (addr == UT64_MAX || addr > b->length)
return NULL;
if (left)
*left = b->length - addr;

View File

@ -93,20 +93,17 @@ r_regex_error(int errcode, const RRegex *preg, char *errbuf, size_t errbuf_size)
if (errcode&R_REGEX_ITOA) {
if (r->code != 0) {
assert(strlen(r->name) < sizeof(convbuf));
(void) strlcpy(convbuf, r->name, sizeof convbuf);
(void) strlcpy(convbuf, r->name, sizeof (convbuf)-1);
} else
(void)snprintf(convbuf, sizeof convbuf,
"R_REGEX_0x%x", target);
s = convbuf;
} else
s = r->explain;
} else s = r->explain;
}
len = strlen(s) + 1;
if (errbuf_size > 0) {
if (errbuf_size > 0)
strlcpy(errbuf, s, errbuf_size);
}
return(len);
}

View File

@ -119,6 +119,5 @@ parse.mips_pseudo
parse.dalvik_pseudo
parse.x86_pseudo"
SHARED="
asm.csr
asm.psosvm
io.shm"

117
plugins.emscripten.cfg Normal file
View File

@ -0,0 +1,117 @@
STATIC="
asm.java
asm.arc
asm.arm
asm.dalvik
asm.ppc
asm.mips
asm.x86
asm.x86_olly
asm.x86_nz
anal.x86_udis
anal.arm
anal.mips
anal.java
anal.dalvik
bin.any
bin.bios
bin.elf
bin.elf64
bin.java
bin.dex
bin.pe
bin.mz
bin.pe64
bin.mach0
bin.mach064
bin_xtr.fatmach0
bp.arm
bp.x86
bp.mips
cmd.dummy
egg.exec
egg.xor
io.malloc
parse.mreplace
parse.att2intel
parse.mips_pseudo
parse.dalvik_pseudo
parse.x86_pseudo"
SHARED="
io.mach
io.debug
io.mmap
io.w32
io.w32dbg
io.ihex
crypto.aes
io.rap
io.ewf
io.http
io.bfdbg
io.gdb
io.haret
bin_xtr.dyldcache
fs.fat
fs.ntfs
fs.ext2
fs.hfs
fs.hfsplus
fs.reiserfs
fs.tar
fs.cpio
fs.xfs
fs.iso9660
fs.udf
fs.ufs
fs.posix
fs.jfs
fs.minix
fs.fb
fs.sfs
io.ptrace
io.procpid
io.shm
io.zip
asm.z80
asm.i8080
asm.8051
asm.msil
asm.c55plus
asm.sh
asm.csr
asm.avr
asm.arm_winedbg
asm.sparc
anal.ppc
anal.sparc
anal.8051
anal.i8080
anal.arc
anal.bf
anal.z80
anal.csr
anal.c55plus
anal.avr
anal.m68k
anal.sh
anal.x86_im
anal.x86_simple
bin.fs
bin.p9
bin.rar
bin.te
bp.bf
bp.ppc
debug.native
debug.esil
debug.gdb
debug.rap
debug.bf
asm.dcpu16
asm.m68k
asm.rar
asm.bf
asm.csr
asm.psosvm
io.shm"

View File

@ -15,6 +15,8 @@ export AR="emar"
CFGFLAGS="./configure --prefix=/usr --disable-shared --enable-static --disable-debugger --with-compiler=emscripten --without-ewf --without-pic --with-nonpic --without-gmp"
make mrproper
cp -f plugins.emscripten.cfg plugins.cfg
./configure-plugins
./configure ${CFGFLAGS} --host=emscripten && \
make -s -j ${MAKE_JOBS} DEBUG=0