Skip to content

Commit

Permalink
Merge pull request radareorg#11 from rchiossi/master
Browse files Browse the repository at this point in the history
rasm2 fix for -D
  • Loading branch information
radare committed Aug 30, 2012
2 parents d843506 + f723d8c commit 48ea684
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions binr/rasm2/rasm2.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,9 @@ static int rasm_disasm(char *buf, ut64 offset, ut64 len, int ascii, int bin, int
if (hex) {
RAsmOp op;
r_asm_set_pc (a, offset);
while (r_asm_disassemble (a, &op, data+ret, len-ret) != -1) {
while (len-ret > 0 && r_asm_disassemble (a, &op, data+ret, len-ret) != -1) {
printf ("0x%08"PFMT64x" %d %12s %s\n",
a->pc, op.inst_len, op.buf_hex, op.buf_asm);
if (ret<1) break;
ret += op.inst_len;
r_asm_set_pc (a, offset+ret);
}
Expand Down Expand Up @@ -272,7 +271,7 @@ int main(int argc, char *argv[]) {
else ret = rasm_asm (buf, offset, len, bin);
idx += ret;
offset += ret;
if (ret<1) {
if (!ret) {
eprintf ("invalid\n");
return 0;
}
Expand All @@ -283,7 +282,7 @@ int main(int argc, char *argv[]) {
}
if (dis) ret = rasm_disasm (argv[optind], offset, len, ascii, bin, dis-1);
else ret = rasm_asm (argv[optind], offset, len, bin);
//if (!ret) eprintf ("invalid\n");
if (!ret) eprintf ("invalid\n");
return ret;
}
return 0;
Expand Down

0 comments on commit 48ea684

Please sign in to comment.