Pass arg by pointer in anal.ws (#16468)

This commit is contained in:
Liumeo 2020-04-07 17:51:53 -04:00 committed by GitHub
parent 4e08d7b01e
commit 3a95531bea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 8 deletions

View File

@ -9,19 +9,19 @@
#define WS_API static
#include "../../asm/arch/whitespace/wsdis.c"
static ut64 ws_find_label(int l, RIOBind iob) {
RIO *io = iob.io;
ut64 cur = 0, size = iob.desc_size (io->desc);
static ut64 ws_find_label(int l, const RIOBind *iob) {
RIO *io = iob->io;
ut64 cur = 0, size = iob->desc_size (io->desc);
ut8 buf[128];
RAsmOp aop;
iob.read_at (iob.io, cur, buf, 128);
iob->read_at (iob->io, cur, buf, 128);
while (cur <= size && wsdis (&aop, buf, 128)) {
const char *buf_asm = r_strbuf_get (&aop.buf_asm); // r_asm_op_get_asm (&aop);
if (buf_asm && (strlen (buf_asm) > 4) && buf_asm[0] == 'm' && buf_asm[1] == 'a' && l == atoi (buf_asm + 5)) {
return cur;
}
cur = cur + aop.size;
iob.read_at (iob.io, cur, buf, 128);
iob->read_at (iob->io, cur, buf, 128);
}
return 0;
}
@ -63,7 +63,7 @@ static int ws_anal(RAnal *anal, RAnalOp *op, ut64 addr, const ut8 *data, int len
if (buf_asm[1] == 'a') {
op->type = R_ANAL_OP_TYPE_CALL;
op->fail = addr + aop->size;
op->jump = ws_find_label (atoi (buf_asm + 5), anal->iob);
op->jump = ws_find_label (atoi (buf_asm + 5), &anal->iob);
} else {
op->type = R_ANAL_OP_TYPE_UPUSH;
}
@ -71,10 +71,10 @@ static int ws_anal(RAnal *anal, RAnalOp *op, ut64 addr, const ut8 *data, int len
case 'j':
if (buf_asm[1] == 'm') {
op->type = R_ANAL_OP_TYPE_JMP;
op->jump = ws_find_label(atoi (buf_asm + 4), anal->iob);
op->jump = ws_find_label(atoi (buf_asm + 4), &anal->iob);
} else {
op->type = R_ANAL_OP_TYPE_CJMP;
op->jump = ws_find_label(atoi(buf_asm + 3), anal->iob);
op->jump = ws_find_label(atoi(buf_asm + 3), &anal->iob);
}
op->fail = addr + aop->size;
break;