* Fixed infinite loop in asm_x86_olly when str == ""

This commit is contained in:
Nibble 2009-04-20 11:37:54 +02:00
parent 76cf64671f
commit fec51758cc

View File

@ -29,7 +29,7 @@ static int assemble(struct r_asm_t *a, struct r_asm_aop_t *aop, const char *buf)
/* attempt == 0: First attempt */
/* constsize == 0: Address constants and inmediate data of 16/32b */
for (constsize = 0; constsize < 4; constsize++) {
for (attempt = 0, aop->buf_err[0] = '\0'; !aop->buf_err[0]; attempt++) {
for (attempt = 0; ret > 0; attempt++) {
ret = Assemble((char*)buf, a->pc, &asm_obj, attempt, constsize, aop->buf_err);
if (ret > 0 && ret < oret) {
oret = ret;
@ -39,7 +39,7 @@ static int assemble(struct r_asm_t *a, struct r_asm_aop_t *aop, const char *buf)
}
}
aop->inst_len = Assemble((char*)buf, a->pc, &asm_obj, oattempt, oconstsize, aop->buf_err);
if (aop->buf_err[0])
if (aop->inst_len < 0)
aop->inst_len = 0;
aop->disasm_obj = &asm_obj;