From 36038e102f52380413c91c2c2205441c0661b6aa Mon Sep 17 00:00:00 2001 From: Ivan Maidanski Date: Tue, 23 May 2017 01:01:08 +0300 Subject: 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. --- dyn_load.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'dyn_load.c') 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); } -- cgit v1.2.1