summaryrefslogtreecommitdiff
path: root/dyn_load.c
diff options
context:
space:
mode:
authorIvan Maidanski <ivmai@mail.ru>2017-05-23 01:01:08 +0300
committerIvan Maidanski <ivmai@mail.ru>2017-05-23 01:01:08 +0300
commit36038e102f52380413c91c2c2205441c0661b6aa (patch)
treeb32bd56eb2e236a73eefcab600372356596b9076 /dyn_load.c
parente2f72bd4450977c4ca7dadc28fef9efd6ff9bff1 (diff)
downloadbdwgc-36038e102f52380413c91c2c2205441c0661b6aa.tar.gz
Workaround 'array compared to 0', 'untrusted loop bound' false defects
* dyn_load.c [SOLARISDL && !USE_PROC_FOR_LIBRARIES] (GC_FirstDLOpenedLinkMap): Wrap access to dynStructureAddr (which value obtained from a weak symbol) into COVERT_DATAFLOW() in comparison to 0. * dyn_load.c [HAVE_DL_ITERATE_PHDR && !DL_ITERATE_PHDR_STRONG] (GC_register_main_static_data): Wrap access to dl_iterate_phdr weak symbol into COVERT_DATAFLOW() in comparison to 0. * dyn_load.c [HAVE_DL_ITERATE_PHDR] (GC_FirstDLOpenedLinkMap): Wrap access to _DYNAMIC weak symbol into COVERT_DATAFLOW() in comparison to 0. * include/private/gc_priv.h (TRUSTED_STRING): Pass the argument through COVERT_DATAFLOW. * include/private/gcconfig.h (COVERT_DATAFLOW): New macro. * os_dep.c [SEARCH_FOR_DATA_START] (GC_init_linux_data_start): Wrap access to __data_start and GC_data_start into COVERT_DATAFLOW() in comparison to 0. * tests/disclaim_bench.c: Update comment for include gc_priv.h. * tests/disclaim_bench.c (main): Pass the integer value obtained from command-line argument (and which is used as a loop boundary) through COVERT_DATAFLOW(). * tests/test_cpp.cc (main): Likewise.
Diffstat (limited to 'dyn_load.c')
-rw-r--r--dyn_load.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/dyn_load.c b/dyn_load.c
index 1c50f902..d036364e 100644
--- a/dyn_load.c
+++ b/dyn_load.c
@@ -181,7 +181,7 @@ GC_FirstDLOpenedLinkMap(void)
dynStructureAddr = &_DYNAMIC;
# endif
- if (dynStructureAddr == 0) {
+ if (0 == COVERT_DATAFLOW(dynStructureAddr)) {
/* _DYNAMIC symbol not resolved. */
return(0);
}
@@ -560,7 +560,7 @@ GC_INNER GC_bool GC_register_main_static_data(void)
/* zero (otherwise a compiler might issue a warning). */
return FALSE;
# else
- return (dl_iterate_phdr == 0); /* implicit conversion to function ptr */
+ return 0 == COVERT_DATAFLOW(dl_iterate_phdr);
# endif
}
@@ -690,7 +690,7 @@ GC_FirstDLOpenedLinkMap(void)
{
static struct link_map *cachedResult = 0;
- if (0 == (ptr_t)_DYNAMIC) {
+ if (0 == COVERT_DATAFLOW(_DYNAMIC)) {
/* _DYNAMIC symbol not resolved. */
return(0);
}