mirror of
https://github.com/radareorg/radare2.git
synced 2024-11-23 13:19:54 +00:00
Fixes some of the issues in Travis (#17267)
* Do not check with r_return_ if the convention is present Let's just assume the NULL default in such a case, so that architectures for which we don't have a defined calling convention can still be processed somehow by the analysis code. It won't be precise, but it's better than nothing. Also add a warning message so users are aware when the calling convention is not defined. * Fix oob-read when # is at the end of the cmd string * Do not set TMPDIR when the new value is the empty string When TMPDIR is set to empty value, clang+ld behaves in weird ways and you cannot compile files from within the r2 shell (e.g. when using #!c or #!cpipe) * Use meson and add -lasan to pkgconfig files when sanitizer are used
This commit is contained in:
parent
3b76cc25c8
commit
594b940b7c
@ -60,7 +60,7 @@ jobs:
|
|||||||
# ASAN as a best effort on every push
|
# ASAN as a best effort on every push
|
||||||
- if: (not head_branch =~ ^release-* AND not head_branch =~ ^prerelease-* AND not branch =~ ^release-* AND not branch =~ ^prerelease-*) AND (head_branch =~ ^asan-* OR type = push)
|
- if: (not head_branch =~ ^release-* AND not head_branch =~ ^prerelease-* AND not branch =~ ^release-* AND not branch =~ ^prerelease-*) AND (head_branch =~ ^asan-* OR type = push)
|
||||||
os: linux
|
os: linux
|
||||||
env: COMPILER_NAME=clang CXX=clang++ CC=clang ASAN=1 ASAN_OPTIONS=detect_odr_violation=0 LSAN_OPTIONS=detect_leaks=0 CFLAGS="-DR2_ASSERT_STDOUT=1"
|
env: COMPILER_NAME=gcc INSTALL_SYSTEM=meson ASAN=1 ASAN_OPTIONS=detect_odr_violation=0 LSAN_OPTIONS=detect_leaks=0 CFLAGS="-DR2_ASSERT_STDOUT=1"
|
||||||
# release-only: meson build with system libraries
|
# release-only: meson build with system libraries
|
||||||
- if: head_branch =~ ^release-* OR head_branch =~ ^prerelease-* OR branch =~ ^release-* OR branch =~ ^prerelease-*
|
- if: head_branch =~ ^release-* OR head_branch =~ ^prerelease-* OR branch =~ ^release-* OR branch =~ ^prerelease-*
|
||||||
os: linux
|
os: linux
|
||||||
@ -68,7 +68,7 @@ jobs:
|
|||||||
# release-only: meson build with ASAN and R2_ASSERT_STDOUT
|
# release-only: meson build with ASAN and R2_ASSERT_STDOUT
|
||||||
- if: head_branch =~ ^release-* OR head_branch =~ ^prerelease-* OR branch =~ ^release-* OR branch =~ ^prerelease-*
|
- if: head_branch =~ ^release-* OR head_branch =~ ^prerelease-* OR branch =~ ^release-* OR branch =~ ^prerelease-*
|
||||||
os: linux
|
os: linux
|
||||||
env: COMPILER_NAME=clang CXX=clang++ CC=clang CFLAGS="-DR2_ASSERT_STDOUT=1" ASAN=1 ASAN_OPTIONS=detect_odr_violation=0 LSAN_OPTIONS=detect_leaks=0 RELEASE=1
|
env: COMPILER_NAME=gcc CFLAGS="-DR2_ASSERT_STDOUT=1" INSTALL_SYSTEM=meson ASAN=1 ASAN_OPTIONS=detect_odr_violation=0 LSAN_OPTIONS=detect_leaks=0 RELEASE=1
|
||||||
# release-only: nogpl plugins file, just test if it builds
|
# release-only: nogpl plugins file, just test if it builds
|
||||||
- if: head_branch =~ ^release-* OR head_branch =~ ^prerelease-* OR branch =~ ^release-* OR branch =~ ^prerelease-*
|
- if: head_branch =~ ^release-* OR head_branch =~ ^prerelease-* OR branch =~ ^release-* OR branch =~ ^prerelease-*
|
||||||
os: linux
|
os: linux
|
||||||
|
@ -100,10 +100,12 @@ R_API bool r_anal_cc_exist(RAnal *anal, const char *convention) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
R_API const char *r_anal_cc_arg(RAnal *anal, const char *convention, int n) {
|
R_API const char *r_anal_cc_arg(RAnal *anal, const char *convention, int n) {
|
||||||
r_return_val_if_fail (anal && convention, NULL);
|
r_return_val_if_fail (anal, NULL);
|
||||||
if (n < 0) {
|
r_return_val_if_fail (n >= 0, NULL);
|
||||||
|
if (!convention) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *query = sdb_fmt ("cc.%s.arg%d", convention, n);
|
const char *query = sdb_fmt ("cc.%s.arg%d", convention, n);
|
||||||
const char *ret = sdb_const_get (DB, query, 0);
|
const char *ret = sdb_const_get (DB, query, 0);
|
||||||
if (!ret) {
|
if (!ret) {
|
||||||
|
@ -195,6 +195,7 @@ pkgconfig_mod.generate(r_anal,
|
|||||||
version: r2_version,
|
version: r2_version,
|
||||||
name: 'r_anal',
|
name: 'r_anal',
|
||||||
filebase: 'r_anal',
|
filebase: 'r_anal',
|
||||||
|
libraries: pkgcfg_sanitize_libs,
|
||||||
requires: [
|
requires: [
|
||||||
'r_util',
|
'r_util',
|
||||||
'r_reg',
|
'r_reg',
|
||||||
|
@ -240,6 +240,7 @@ pkgconfig_mod.generate(r_asm,
|
|||||||
version: r2_version,
|
version: r2_version,
|
||||||
name: 'r_asm',
|
name: 'r_asm',
|
||||||
filebase: 'r_asm',
|
filebase: 'r_asm',
|
||||||
|
libraries: pkgcfg_sanitize_libs,
|
||||||
requires: [
|
requires: [
|
||||||
'r_util',
|
'r_util',
|
||||||
'r_syscall',
|
'r_syscall',
|
||||||
|
@ -165,6 +165,7 @@ pkgconfig_mod.generate(r_bin,
|
|||||||
version: r2_version,
|
version: r2_version,
|
||||||
name: 'r_bin',
|
name: 'r_bin',
|
||||||
filebase: 'r_bin',
|
filebase: 'r_bin',
|
||||||
|
libraries: pkgcfg_sanitize_libs,
|
||||||
requires: pkgconfig_magic_requires + [
|
requires: pkgconfig_magic_requires + [
|
||||||
'r_util',
|
'r_util',
|
||||||
'r_io',
|
'r_io',
|
||||||
|
@ -29,6 +29,7 @@ pkgconfig_mod.generate(r_bp,
|
|||||||
version: r2_version,
|
version: r2_version,
|
||||||
name: 'r_bp',
|
name: 'r_bp',
|
||||||
filebase: 'r_bp',
|
filebase: 'r_bp',
|
||||||
|
libraries: pkgcfg_sanitize_libs,
|
||||||
requires: [
|
requires: [
|
||||||
'r_util'
|
'r_util'
|
||||||
],
|
],
|
||||||
|
@ -22,6 +22,7 @@ pkgconfig_mod.generate(r_config,
|
|||||||
version: r2_version,
|
version: r2_version,
|
||||||
name: 'r_config',
|
name: 'r_config',
|
||||||
filebase: 'r_config',
|
filebase: 'r_config',
|
||||||
|
libraries: pkgcfg_sanitize_libs,
|
||||||
requires: [
|
requires: [
|
||||||
'r_util'
|
'r_util'
|
||||||
],
|
],
|
||||||
|
@ -38,6 +38,7 @@ pkgconfig_mod.generate(r_cons,
|
|||||||
version: r2_version,
|
version: r2_version,
|
||||||
name: 'r_cons',
|
name: 'r_cons',
|
||||||
filebase: 'r_cons',
|
filebase: 'r_cons',
|
||||||
|
libraries: pkgcfg_sanitize_libs,
|
||||||
requires: [
|
requires: [
|
||||||
'r_util'
|
'r_util'
|
||||||
],
|
],
|
||||||
|
@ -770,6 +770,7 @@ static int __core_anal_fcn(RCore *core, ut64 at, ut64 from, int reftype, int dep
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
fcn->cc = r_str_constpool_get (&core->anal->constpool, r_anal_cc_default (core->anal));
|
fcn->cc = r_str_constpool_get (&core->anal->constpool, r_anal_cc_default (core->anal));
|
||||||
|
r_warn_if_fail (!core->anal->sdb_cc->path || fcn->cc);
|
||||||
hint = r_anal_hint_get (core->anal, at);
|
hint = r_anal_hint_get (core->anal, at);
|
||||||
if (hint && hint->bits == 16) {
|
if (hint && hint->bits == 16) {
|
||||||
// expand 16bit for function
|
// expand 16bit for function
|
||||||
|
@ -1155,11 +1155,10 @@ static bool cb_dirhome(void *user, void *data) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool cb_dirtmp (void *user, void *data) {
|
static bool cb_dirtmp(void *user, void *data) {
|
||||||
RConfigNode *node = (RConfigNode*) data;
|
RConfigNode *node = (RConfigNode *)data;
|
||||||
if (node->value) {
|
char *value = R_STR_ISNOTEMPTY (node->value)? node->value: NULL;
|
||||||
r_sys_setenv (R_SYS_TMP, node->value);
|
r_sys_setenv (R_SYS_TMP, value);
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -438,7 +438,11 @@ static int r_core_file_do_load_for_io_plugin(RCore *r, ut64 baseaddr, ut64 loada
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
binfile = r_bin_cur (r->bin);
|
binfile = r_bin_cur (r->bin);
|
||||||
r_core_bin_set_env (r, binfile);
|
if (r_core_bin_set_env (r, binfile)) {
|
||||||
|
if (!r->anal->sdb_cc->path) {
|
||||||
|
R_LOG_WARN ("No calling convention defined for this file, analysis may be inaccurate.\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
plugin = r_bin_file_cur_plugin (binfile);
|
plugin = r_bin_file_cur_plugin (binfile);
|
||||||
if (plugin && !strcmp (plugin->name, "any")) {
|
if (plugin && !strcmp (plugin->name, "any")) {
|
||||||
RBinObject *obj = r_bin_cur_object (r->bin);
|
RBinObject *obj = r_bin_cur_object (r->bin);
|
||||||
|
@ -1740,6 +1740,7 @@ static bool cmd_r2cmd(RCore *core, const char *_input) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
free (input);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
free (input);
|
free (input);
|
||||||
@ -2630,7 +2631,7 @@ static int r_core_cmd_subst(RCore *core, char *cmd) {
|
|||||||
if (*hash == '\\') {
|
if (*hash == '\\') {
|
||||||
hash++;
|
hash++;
|
||||||
if (*hash == '#') {
|
if (*hash == '#') {
|
||||||
hash++;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (*hash == '#') {
|
if (*hash == '#') {
|
||||||
|
@ -128,6 +128,7 @@ pkgconfig_mod.generate(
|
|||||||
version: r2_version,
|
version: r2_version,
|
||||||
name: 'r_core',
|
name: 'r_core',
|
||||||
filebase: 'r_core',
|
filebase: 'r_core',
|
||||||
|
libraries: pkgcfg_sanitize_libs,
|
||||||
requires: pkgconfig_magic_requires + [
|
requires: pkgconfig_magic_requires + [
|
||||||
'r_util',
|
'r_util',
|
||||||
'r_reg',
|
'r_reg',
|
||||||
|
@ -38,6 +38,7 @@ pkgconfig_mod.generate(r_crypto,
|
|||||||
version: r2_version,
|
version: r2_version,
|
||||||
name: 'r_crypto',
|
name: 'r_crypto',
|
||||||
filebase: 'r_crypto',
|
filebase: 'r_crypto',
|
||||||
|
libraries: pkgcfg_sanitize_libs,
|
||||||
requires: [
|
requires: [
|
||||||
'r_util'
|
'r_util'
|
||||||
],
|
],
|
||||||
|
@ -115,6 +115,7 @@ pkgconfig_mod.generate(r_debug,
|
|||||||
version: r2_version,
|
version: r2_version,
|
||||||
name: 'r_debug',
|
name: 'r_debug',
|
||||||
filebase: 'r_debug',
|
filebase: 'r_debug',
|
||||||
|
libraries: pkgcfg_sanitize_libs,
|
||||||
requires: [
|
requires: [
|
||||||
'r_util',
|
'r_util',
|
||||||
'r_hash',
|
'r_hash',
|
||||||
|
@ -36,6 +36,7 @@ pkgconfig_mod.generate(r_egg,
|
|||||||
version: r2_version,
|
version: r2_version,
|
||||||
name: 'r_egg',
|
name: 'r_egg',
|
||||||
filebase: 'r_egg',
|
filebase: 'r_egg',
|
||||||
|
libraries: pkgcfg_sanitize_libs,
|
||||||
requires: [
|
requires: [
|
||||||
'r_util',
|
'r_util',
|
||||||
'r_asm',
|
'r_asm',
|
||||||
|
@ -23,6 +23,7 @@ pkgconfig_mod.generate(r_flag,
|
|||||||
version: r2_version,
|
version: r2_version,
|
||||||
name: 'r_flag',
|
name: 'r_flag',
|
||||||
filebase: 'r_flag',
|
filebase: 'r_flag',
|
||||||
|
libraries: pkgcfg_sanitize_libs,
|
||||||
requires: [
|
requires: [
|
||||||
'r_util'
|
'r_util'
|
||||||
],
|
],
|
||||||
|
@ -46,6 +46,7 @@ pkgconfig_mod.generate(r_fs,
|
|||||||
version: r2_version,
|
version: r2_version,
|
||||||
name: 'r_fs',
|
name: 'r_fs',
|
||||||
filebase: 'r_fs',
|
filebase: 'r_fs',
|
||||||
|
libraries: pkgcfg_sanitize_libs,
|
||||||
requires: [
|
requires: [
|
||||||
'r_util'
|
'r_util'
|
||||||
],
|
],
|
||||||
|
@ -41,6 +41,7 @@ pkgconfig_mod.generate(r_hash,
|
|||||||
version: r2_version,
|
version: r2_version,
|
||||||
name: 'r_hash',
|
name: 'r_hash',
|
||||||
filebase: 'r_hash',
|
filebase: 'r_hash',
|
||||||
|
libraries: pkgcfg_sanitize_libs,
|
||||||
requires: [
|
requires: [
|
||||||
'r_util'
|
'r_util'
|
||||||
],
|
],
|
||||||
|
@ -94,6 +94,7 @@ pkgconfig_mod.generate(r_io,
|
|||||||
version: r2_version,
|
version: r2_version,
|
||||||
name: 'r_io',
|
name: 'r_io',
|
||||||
filebase: 'r_io',
|
filebase: 'r_io',
|
||||||
|
libraries: pkgcfg_sanitize_libs,
|
||||||
requires: [
|
requires: [
|
||||||
'r_util',
|
'r_util',
|
||||||
'r_socket'
|
'r_socket'
|
||||||
|
@ -30,6 +30,7 @@ pkgconfig_mod.generate(r_lang,
|
|||||||
version: r2_version,
|
version: r2_version,
|
||||||
name: 'r_lang',
|
name: 'r_lang',
|
||||||
filebase: 'r_lang',
|
filebase: 'r_lang',
|
||||||
|
libraries: pkgcfg_sanitize_libs,
|
||||||
requires: [
|
requires: [
|
||||||
'r_util',
|
'r_util',
|
||||||
'r_cons'
|
'r_cons'
|
||||||
|
@ -36,6 +36,7 @@ pkgconfig_mod.generate(r_magic,
|
|||||||
version: r2_version,
|
version: r2_version,
|
||||||
name: 'r_magic',
|
name: 'r_magic',
|
||||||
filebase: 'r_magic',
|
filebase: 'r_magic',
|
||||||
|
libraries: pkgcfg_sanitize_libs,
|
||||||
requires: [
|
requires: [
|
||||||
'r_util'
|
'r_util'
|
||||||
],
|
],
|
||||||
|
@ -56,6 +56,7 @@ pkgconfig_mod.generate(r_main,
|
|||||||
subdirs: 'libr',
|
subdirs: 'libr',
|
||||||
version: r2_version,
|
version: r2_version,
|
||||||
name: 'r_main',
|
name: 'r_main',
|
||||||
|
libraries: pkgcfg_sanitize_libs,
|
||||||
filebase: 'r_main',
|
filebase: 'r_main',
|
||||||
requires: [
|
requires: [
|
||||||
'r_core',
|
'r_core',
|
||||||
|
@ -43,6 +43,7 @@ pkgconfig_mod.generate(r_parse,
|
|||||||
version: r2_version,
|
version: r2_version,
|
||||||
name: 'r_parse',
|
name: 'r_parse',
|
||||||
filebase: 'r_parse',
|
filebase: 'r_parse',
|
||||||
|
libraries: pkgcfg_sanitize_libs,
|
||||||
requires: [
|
requires: [
|
||||||
'r_util',
|
'r_util',
|
||||||
'r_flag',
|
'r_flag',
|
||||||
|
@ -24,6 +24,7 @@ pkgconfig_mod.generate(r_reg,
|
|||||||
version: r2_version,
|
version: r2_version,
|
||||||
name: 'r_reg',
|
name: 'r_reg',
|
||||||
filebase: 'r_reg',
|
filebase: 'r_reg',
|
||||||
|
libraries: pkgcfg_sanitize_libs,
|
||||||
requires: [
|
requires: [
|
||||||
'r_util'
|
'r_util'
|
||||||
],
|
],
|
||||||
|
@ -25,6 +25,7 @@ pkgconfig_mod.generate(r_search,
|
|||||||
version: r2_version,
|
version: r2_version,
|
||||||
name: 'r_search',
|
name: 'r_search',
|
||||||
filebase: 'r_search',
|
filebase: 'r_search',
|
||||||
|
libraries: pkgcfg_sanitize_libs,
|
||||||
requires: [
|
requires: [
|
||||||
'r_util'
|
'r_util'
|
||||||
],
|
],
|
||||||
|
@ -33,6 +33,7 @@ pkgconfig_mod.generate(r_socket,
|
|||||||
version: r2_version,
|
version: r2_version,
|
||||||
name: 'r_socket',
|
name: 'r_socket',
|
||||||
filebase: 'r_socket',
|
filebase: 'r_socket',
|
||||||
|
libraries: pkgcfg_sanitize_libs,
|
||||||
requires: [
|
requires: [
|
||||||
'r_util'
|
'r_util'
|
||||||
],
|
],
|
||||||
|
@ -22,6 +22,7 @@ pkgconfig_mod.generate(r_syscall,
|
|||||||
version: r2_version,
|
version: r2_version,
|
||||||
name: 'r_syscall',
|
name: 'r_syscall',
|
||||||
filebase: 'r_syscall',
|
filebase: 'r_syscall',
|
||||||
|
libraries: pkgcfg_sanitize_libs,
|
||||||
requires: [
|
requires: [
|
||||||
'r_util'
|
'r_util'
|
||||||
],
|
],
|
||||||
|
@ -112,6 +112,7 @@ r_util_dep = declare_dependency(link_with: r_util,
|
|||||||
pkgconfig_mod.generate(r_util,
|
pkgconfig_mod.generate(r_util,
|
||||||
subdirs: 'libr',
|
subdirs: 'libr',
|
||||||
version: r2_version,
|
version: r2_version,
|
||||||
|
libraries: pkgcfg_sanitize_libs,
|
||||||
name: 'r_util',
|
name: 'r_util',
|
||||||
filebase: 'r_util',
|
filebase: 'r_util',
|
||||||
description: 'radare foundation libraries'
|
description: 'radare foundation libraries'
|
||||||
|
@ -398,6 +398,14 @@ libr_pc = configure_file(
|
|||||||
install_dir: join_paths(get_option('libdir'), 'pkgconfig')
|
install_dir: join_paths(get_option('libdir'), 'pkgconfig')
|
||||||
)
|
)
|
||||||
|
|
||||||
|
pkgcfg_sanitize_libs = ''
|
||||||
|
if get_option('b_sanitize').contains('address')
|
||||||
|
pkgcfg_sanitize_libs += ' -lasan'
|
||||||
|
endif
|
||||||
|
if get_option('b_sanitize').contains('undefined')
|
||||||
|
pkgcfg_sanitize_libs += ' -lubsan'
|
||||||
|
endif
|
||||||
|
|
||||||
subdir('shlr')
|
subdir('shlr')
|
||||||
|
|
||||||
subdir('libr/util')
|
subdir('libr/util')
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
NAME=#!c
|
NAME=#!c
|
||||||
FILE=-
|
FILE=-
|
||||||
CMDS=<<EOF
|
CMDS=<<EOF
|
||||||
"?e #include <stdio.h>\nint entry(){printf(\"Hello\\n\");}" > .tmp-hashc.c
|
"?e #include <stdio.h>\nint entry(){printf(\"Hello\\n\");return 0;}" > .tmp-hashc.c
|
||||||
#!c .tmp-hashc.c
|
#!c .tmp-hashc.c
|
||||||
rm .tmp-hashc.c
|
rm .tmp-hashc.c
|
||||||
EOF
|
EOF
|
||||||
@ -13,7 +13,7 @@ RUN
|
|||||||
NAME=#! with ext != name
|
NAME=#! with ext != name
|
||||||
FILE=-
|
FILE=-
|
||||||
CMDS=<<EOF
|
CMDS=<<EOF
|
||||||
"?e #include <stdio.h>\nint main(){printf(\"Hello\\n\");}" > .tmp-hashextname.c
|
"?e #include <stdio.h>\nint main(){printf(\"Hello\\n\");return 0;}" > .tmp-hashextname.c
|
||||||
#!cpipe .tmp-hashextname.c
|
#!cpipe .tmp-hashextname.c
|
||||||
rm .tmp-hashextname.c
|
rm .tmp-hashextname.c
|
||||||
EOF
|
EOF
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
NAME=#!c
|
NAME=#!c
|
||||||
FILE=-
|
FILE=-
|
||||||
CMDS=<<EOF
|
CMDS=<<EOF
|
||||||
"?e #include <stdio.h>\nint entry(){printf(\"Hello\\n\");}" > .tmp-hashc.c
|
"?e #include <stdio.h>\nint entry(){printf(\"Hello\\n\");return 0;}" > .tmp-hashc.c
|
||||||
#!c .tmp-hashc.c
|
#!c .tmp-hashc.c
|
||||||
rm .tmp-hashc.c
|
rm .tmp-hashc.c
|
||||||
EOF
|
EOF
|
||||||
@ -13,7 +13,7 @@ RUN
|
|||||||
NAME=#! with ext != name
|
NAME=#! with ext != name
|
||||||
FILE=-
|
FILE=-
|
||||||
CMDS=<<EOF
|
CMDS=<<EOF
|
||||||
"?e #include <stdio.h>\nint main(){printf(\"Hello\\n\");}" > .tmp-hashextname.c
|
"?e #include <stdio.h>\nint main(){printf(\"Hello\\n\");return 0;}" > .tmp-hashextname.c
|
||||||
#!cpipe .tmp-hashextname.c
|
#!cpipe .tmp-hashextname.c
|
||||||
rm .tmp-hashextname.c
|
rm .tmp-hashextname.c
|
||||||
EOF
|
EOF
|
||||||
|
Loading…
Reference in New Issue
Block a user