mirror of
https://github.com/radareorg/radare2.git
synced 2025-01-25 23:34:57 +00:00
Fix regressions in pf parsing and enhance error reporting
This commit is contained in:
parent
0053dfefd8
commit
c70c8f78ee
@ -29,8 +29,8 @@ static void print_meta_offset(RCore *core, ut64 offset) {
|
||||
if (line >= 2)
|
||||
line -= 2;
|
||||
if (r_file_exists (file)) {
|
||||
for (i = 0; i<5; i++) {
|
||||
char *row = r_file_slurp_line (file, line+i, 0);
|
||||
for (i = 0; i < 5; i++) {
|
||||
char *row = r_file_slurp_line (file, line + i, 0);
|
||||
if (row) {
|
||||
r_cons_printf ("%c %.3x %s\n", line+i == line_old ? '>' : ' ', line+i, row);
|
||||
free (row);
|
||||
@ -488,6 +488,9 @@ static int cmd_meta_hsdmf(RCore *core, const char *input) {
|
||||
if (r < 0) {
|
||||
n = -1;
|
||||
}
|
||||
} else {
|
||||
eprintf ("Usage: Cf [size] [pf-format-string]\n");
|
||||
break;
|
||||
}
|
||||
} else if (type == 's') { //Cs
|
||||
char tmp[256] = {0};
|
||||
|
@ -1140,12 +1140,12 @@ static void r_print_format_num (const RPrint *p, int endian, int mode, const cha
|
||||
|
||||
// XXX: this is somewhat incomplete. must be updated to handle all format chars
|
||||
int r_print_format_struct_size(const char *f, RPrint *p, int mode) {
|
||||
char *o, *end, *args, *fmt;
|
||||
char *end, *args, *fmt;
|
||||
int size = 0, tabsize = 0, i, idx = 0, biggest = 0, fmt_len = 0;
|
||||
if (!f) {
|
||||
return -1;
|
||||
}
|
||||
o = strdup (f);
|
||||
char *o = strdup (f);
|
||||
if (!o) {
|
||||
return -1;
|
||||
}
|
||||
@ -1316,7 +1316,7 @@ int r_print_format_struct_size(const char *f, RPrint *p, int mode) {
|
||||
eprintf ("Invalid n format.\n");
|
||||
free (o);
|
||||
free (args);
|
||||
return -1;
|
||||
return -2;
|
||||
}
|
||||
i++;
|
||||
break;
|
||||
@ -1552,8 +1552,8 @@ R_API int r_print_format(RPrint *p, ut64 seek, const ut8* b, const int len,
|
||||
} else {
|
||||
size = -1;
|
||||
}
|
||||
int fs = r_print_format_struct_size(arg, p, 0);
|
||||
if (fs == -1) {
|
||||
int fs = r_print_format_struct_size (arg, p, 0);
|
||||
if (fs == -2) {
|
||||
i = -1;
|
||||
goto beach;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user