From: Ivan Maidanski Date: Tue, 2 Aug 2016 09:01:48 +0000 (+0300) Subject: Do not allow SHORT_DBG_HDRS if KEEP_BACK_PTRS or MAKE_BACK_GRAPH X-Git-Tag: gc7_6_0~3 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9c26cc680832709ede8340b055146e1654660608;p=gc Do not allow SHORT_DBG_HDRS if KEEP_BACK_PTRS or MAKE_BACK_GRAPH Otherwise GC_HAS_DEBUG_INFO (defined as (p&1)) might return true if a non-pointer is stored at the beginning of the tested object leading further to its corruption by GC_store_back_pointer. See issue #125 for details. * include/private/dbg_mlc.h [KEEP_BACK_PTRS || MAKE_BACK_GRAPH] (GC_HAS_DEBUG_INFO): Add #error (with the appropriate message) in case of SHORT_DBG_HDRS defined. --- diff --git a/include/private/dbg_mlc.h b/include/private/dbg_mlc.h index 663de702..ae2c70e9 100644 --- a/include/private/dbg_mlc.h +++ b/include/private/dbg_mlc.h @@ -157,6 +157,10 @@ typedef struct { #endif #if defined(KEEP_BACK_PTRS) || defined(MAKE_BACK_GRAPH) +# ifdef SHORT_DBG_HDRS +# error Non-ptr stored in object results in GC_HAS_DEBUG_INFO malfunction + /* We may mistakenly conclude that p has a debugging wrapper. */ +# endif # define GC_HAS_DEBUG_INFO(p) \ ((*((word *)p) & 1) && GC_has_other_debug_info(p) > 0) #else