Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rasm2 fix for -D #11

Merged
merged 1 commit into from
Aug 30, 2012
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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