mirror of
https://github.com/radareorg/radare2.git
synced 2024-11-23 21:29:49 +00:00
Upgrade capstone to fix m68k bugs
Revert "Fix #9855 - Enlarge tmpbuf to 128 bytes because capstone code is crap" -11f99872f5
. Revert "Fix #9852 - Workaround to avoid capstone-m68k crash" -0607b97b01
.
This commit is contained in:
parent
51d2b7894e
commit
e90fd02b97
@ -84,9 +84,6 @@ static int analop(RAnal *a, RAnalOp *op, ut64 addr, const ut8 *buf, int len) {
|
||||
cs_insn* insn;
|
||||
int mode = a->big_endian? CS_MODE_BIG_ENDIAN: CS_MODE_LITTLE_ENDIAN;
|
||||
|
||||
if (len < 2) {
|
||||
return -1;
|
||||
}
|
||||
//mode |= (a->bits==64)? CS_MODE_64: CS_MODE_32;
|
||||
if (mode != omode || a->bits != obits) {
|
||||
cs_close (&handle);
|
||||
@ -97,12 +94,10 @@ static int analop(RAnal *a, RAnalOp *op, ut64 addr, const ut8 *buf, int len) {
|
||||
// XXX no arch->cpu ?!?! CS_MODE_MICRO, N64
|
||||
op->delay = 0;
|
||||
// replace this with the asm.features?
|
||||
if (a->cpu && strstr (a->cpu, "68000")) {
|
||||
if (a->cpu && strstr (a->cpu, "68000"))
|
||||
mode |= CS_MODE_M68K_000;
|
||||
}
|
||||
if (a->cpu && strstr (a->cpu, "68010")) {
|
||||
if (a->cpu && strstr (a->cpu, "68010"))
|
||||
mode |= CS_MODE_M68K_010;
|
||||
}
|
||||
if (a->cpu && strstr (a->cpu, "68020"))
|
||||
mode |= CS_MODE_M68K_020;
|
||||
if (a->cpu && strstr (a->cpu, "68030"))
|
||||
@ -117,11 +112,7 @@ static int analop(RAnal *a, RAnalOp *op, ut64 addr, const ut8 *buf, int len) {
|
||||
if (ret != CS_ERR_OK) goto fin;
|
||||
cs_option (handle, CS_OPT_DETAIL, CS_OPT_ON);
|
||||
}
|
||||
// XXX this is a workaround to avoid capstone to crash
|
||||
ut8 mybuf[128] = {0};
|
||||
int mylen = R_MIN (sizeof (mybuf), len);
|
||||
memcpy (mybuf, buf, mylen);
|
||||
n = cs_disasm (handle, (ut8*)mybuf, len, addr, 1, &insn);
|
||||
n = cs_disasm (handle, (ut8*)buf, len, addr, 1, &insn);
|
||||
if (n < 1 || insn->size < 1) {
|
||||
op->type = R_ANAL_OP_TYPE_ILL;
|
||||
op->size = 2;
|
||||
|
@ -66,9 +66,9 @@ static int disassemble(RAsm *a, RAsmOp *op, const ut8 *buf, int len) {
|
||||
if (!buf) {
|
||||
goto beach;
|
||||
}
|
||||
ut8 mybuf[128] = {0};
|
||||
int mylen = R_MIN (sizeof (mybuf), len);
|
||||
memcpy (mybuf, buf, mylen);
|
||||
ut8 mybuf[8] = {0};
|
||||
int mylen = R_MIN (8, len);
|
||||
memcpy (mybuf, buf, R_MIN (8, len));
|
||||
n = cs_disasm (cd, mybuf, mylen, a->pc, 1, &insn);
|
||||
if (n < 1) {
|
||||
ret = -1;
|
||||
|
@ -268,20 +268,21 @@ R_API char *r_hex_from_js(const char *code) {
|
||||
char * str = r_str_ndup (start + 1, end - start - 1);
|
||||
|
||||
/* assuming base64 input, output will always be shorter */
|
||||
ut8 * b64d = malloc (end - start);
|
||||
ut8 *b64d = malloc (end - start);
|
||||
if (!b64d) {
|
||||
free (str);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
r_base64_decode (b64d, str, end - start - 1);
|
||||
if (b64d < 1) {
|
||||
if (!b64d) {
|
||||
free (str);
|
||||
free (b64d);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int i, len = strlen (b64d);
|
||||
// TODO: use r_str_bin2hex
|
||||
int i, len = strlen ((const char *)b64d);
|
||||
char * out = malloc (len * 2 + 1);
|
||||
if (!out) {
|
||||
free (str);
|
||||
@ -298,7 +299,6 @@ R_API char *r_hex_from_js(const char *code) {
|
||||
return out;
|
||||
}
|
||||
|
||||
|
||||
/* convert
|
||||
* "\x41\x23\x42\x1b"
|
||||
* "\x41\x23\x42\x1b"
|
||||
|
@ -23,9 +23,9 @@ CS_PATCHES=0
|
||||
else
|
||||
CS_TAR=
|
||||
CS_URL=$(GIT_PREFIX)github.com/aquynh/capstone.git
|
||||
CS_UPD=20180410
|
||||
CS_UPD=20180511
|
||||
CS_BRA=next
|
||||
CS_TIP=863ec0aba8fbfdc83090ba21d3afad9e1a51d96c
|
||||
CS_TIP=37569a6874c8547b349a80823adda9284499fe80
|
||||
# REVERT THIS COMMIT BECAUSE ITS WRONG
|
||||
CS_REV=
|
||||
CS_PATCHES=1
|
||||
|
Loading…
Reference in New Issue
Block a user