Fix asan crash and r2r regression

This commit is contained in:
pancake 2021-01-31 23:42:19 +01:00
parent 8cf1adfb27
commit ccfea838b9
3 changed files with 14 additions and 4 deletions

View File

@ -613,7 +613,7 @@ static bool database_load(R2RTestDatabase *db, const char *path, int depth) {
char *sa = r_sys_getenv ("R2R_SKIP_ARCHOS");
bool skip_archos = sa? !strcmp (sa, "1"): false;
free (sa);
if (sa) {
if (skip_archos) {
if ((!strcmp (path, "archos") || r_str_endswith (path, R_SYS_DIR"archos"))
&& strcmp (subname, R2R_ARCH_OS)) {
eprintf ("Skipping %s"R_SYS_DIR"%s because it does not match the current platform.\n", path, subname);

View File

@ -1,4 +1,4 @@
/* radare - LGPL - Copyright 2020 - thestr4ng3r */
/* radare - LGPL - Copyright 2020-2021 - thestr4ng3r */
#include "r2r.h"
#include <assert.h>

View File

@ -3030,8 +3030,18 @@ static bool ds_print_meta_infos(RDisasmState *ds, ut8* buf, int len, int idx, in
if (!ds_print_data_type (ds, buf + idx, ds->hint? ds->hint->immbase: 0, size)) {
if (size > delta) {
r_cons_printf ("hex size=%d delta=%d\n", size , delta);
r_print_hexdump (core->print, ds->at,
buf + idx, size - delta, 16, 1, 1);
int remaining = size - delta;
remaining = R_MAX (remaining, 0);
if (remaining > (len - delta)) {
ut8 *b = calloc (1, size - delta);
memcpy (b, buf, len);
r_print_hexdump (core->print, ds->at,
b + idx, remaining, 16, 1, 1);
free (b);
} else {
r_print_hexdump (core->print, ds->at,
buf + idx, remaining, 16, 1, 1);
}
} else {
r_cons_printf ("hex size=%d hexlen=%d delta=%d",
size, hexlen, delta);