Fix #12725 - pf* exposes flag sizes via fl and Cd ##types (#13080)

This commit is contained in:
radare 2019-02-14 00:17:01 +01:00 committed by GitHub
parent 69ed84834c
commit 11ad0a732d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 4 deletions

View File

@ -853,7 +853,6 @@ R_API bool r_bin_file_hash(RBin *bin, ut64 limit, const char *file) {
char hash[128], *p;
RHash *ctx;
ut64 buf_len = 0, r = 0;
int i;
RBinFile *bf = bin->cur;
if (!bf) {
return false;
@ -895,8 +894,12 @@ R_API bool r_bin_file_hash(RBin *bin, ut64 limit, const char *file) {
r_io_desc_seek (iod, r, R_IO_SEEK_SET);
const size_t rem_len = buf_len-r;
int b = r_io_desc_read (iod, buf, rem_len);
(void)r_hash_do_md5 (ctx, buf, rem_len);
(void)r_hash_do_sha1 (ctx, buf, rem_len);
if (b < 1) {
eprintf ("r_io_desc_read: error\n");
} else {
(void)r_hash_do_md5 (ctx, buf, b);
(void)r_hash_do_sha1 (ctx, buf, b);
}
}
r_hash_do_end (ctx, R_HASH_MD5);
p = hash;

View File

@ -1500,7 +1500,7 @@ int r_print_format_struct_size(const char *f, RPrint *p, int mode, int n) {
}
i = 0;
if (IS_DIGIT(fmt[i])) {
if (IS_DIGIT (fmt[i])) {
while (IS_DIGIT(fmt[i])) {
i++;
}
@ -2179,6 +2179,7 @@ R_API int r_print_format(RPrint *p, ut64 seek, const ut8* b, const int len,
}
bool noline = false;
int oi = i;
if (isptr == NULLPTR) {
if (MUSTSEEJSON) {
p->cb_printf ("\"NULL\"}", tmp, seek + i);
@ -2461,6 +2462,13 @@ R_API int r_print_format(RPrint *p, ut64 seek, const ut8* b, const int len,
if (mode & R_PRINT_DOT) {
p->cb_printf ("}");
}
if (mode & R_PRINT_SEEFLAGS && isptr != NULLPTR) {
int sz = i - oi;
if (sz > 1) {
p->cb_printf ("fl %d @ 0x%08"PFMT64x"\n", sz, seeki);
p->cb_printf ("Cd %d @ 0x%08"PFMT64x"\n", sz, seeki);
}
}
if (viewflags && p->offname) {
const char *s = p->offname (p->user, seeki);
if (s) {