summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvan Maidanski <ivmai@mail.ru>2023-04-08 13:00:11 +0300
committerIvan Maidanski <ivmai@mail.ru>2023-04-28 22:16:18 +0300
commite0a3770947c772fee157fe0d1ff56ea6f06cbaa1 (patch)
tree52155229820cef051128d9d77fc79c44325294bc
parentf2f784b89297e5cb620078913c2f631cea546386 (diff)
downloadbdwgc-e0a3770947c772fee157fe0d1ff56ea6f06cbaa1.tar.gz
Fix null pointer dereference in TRACE_TARGET
* include/private/gc_pmark.h [ENABLE_TRACE] (TRACE_TARGET): Do not dereference GC_trace_addr if it is not a pointer to a heap object.
-rw-r--r--include/private/gc_pmark.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/include/private/gc_pmark.h b/include/private/gc_pmark.h
index 1e70d07a..b35de7d6 100644
--- a/include/private/gc_pmark.h
+++ b/include/private/gc_pmark.h
@@ -200,7 +200,8 @@ GC_INNER mse * GC_signal_mark_stack_overflow(mse *msp);
# define TRACE(source, cmd) \
if (GC_trace_addr != 0 && (ptr_t)(source) == GC_trace_addr) cmd
# define TRACE_TARGET(target, cmd) \
- if (GC_trace_addr != 0 && (target) == *(ptr_t *)GC_trace_addr) cmd
+ if (GC_trace_addr != NULL && GC_is_heap_ptr(GC_trace_addr) \
+ && (target) == *(ptr_t *)GC_trace_addr) cmd
#else
# define TRACE(source, cmd)
# define TRACE_TARGET(source, cmd)