mirror of
https://github.com/radareorg/radare2.git
synced 2024-12-03 19:01:31 +00:00
Fix infinite loop in pif and fix pif test
This commit is contained in:
parent
b9a1cc60b7
commit
56119f04b2
@ -2995,11 +2995,13 @@ static int cmd_print(void *data, const char *input) {
|
||||
case 'f': // "pif"
|
||||
if (l != 0) {
|
||||
RAnalFunction *f = r_anal_get_fcn_in (core->anal, core->offset,
|
||||
R_ANAL_FCN_TYPE_FCN|R_ANAL_FCN_TYPE_SYM);
|
||||
R_ANAL_FCN_TYPE_FCN | R_ANAL_FCN_TYPE_SYM);
|
||||
if (f) {
|
||||
ut32 bsz = core->blocksize;
|
||||
r_core_block_size (core, r_anal_fcn_realsize (f));
|
||||
r_core_print_disasm_instructions (core, 0, 0);
|
||||
// int fsz = r_anal_fcn_realsize (f);
|
||||
int fsz = r_anal_fcn_size (f); // we want max-min here
|
||||
r_core_block_size (core, fsz);
|
||||
r_core_print_disasm_instructions (core, fsz, 0);
|
||||
r_core_block_size (core, bsz);
|
||||
} else {
|
||||
r_core_print_disasm_instructions (core,
|
||||
|
@ -3793,6 +3793,10 @@ R_API int r_core_print_disasm_instructions(RCore *core, int nb_bytes, int nb_opc
|
||||
ds->analop.size = ret;
|
||||
ds->asmop.size = ret;
|
||||
}
|
||||
/* fix infinite loop */
|
||||
if (ret < 1) {
|
||||
ret = 1;
|
||||
}
|
||||
len += R_MAX (0, ret);
|
||||
if (ds->hint && ds->hint->opcode) {
|
||||
free (ds->opstr);
|
||||
@ -3826,8 +3830,8 @@ R_API int r_core_print_disasm_instructions(RCore *core, int nb_bytes, int nb_opc
|
||||
}
|
||||
}
|
||||
core->parser->hint = ds->hint;
|
||||
r_parse_filter (core->parser, core->flags,
|
||||
ds->asmop.buf_asm, ds->str, sizeof (ds->str), core->print->big_endian);
|
||||
r_parse_filter (core->parser, core->flags, ds->asmop.buf_asm, ds->str,
|
||||
sizeof (ds->str), core->print->big_endian);
|
||||
ds->opstr = strdup (ds->str);
|
||||
asm_str = colorize_asm_string (core, ds);
|
||||
core->parser->flagspace = ofs;
|
||||
|
Loading…
Reference in New Issue
Block a user