summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorIvan Maidanski <ivmai@mail.ru>2023-04-08 13:00:11 +0300
committerIvan Maidanski <ivmai@mail.ru>2023-04-09 10:55:49 +0300
commit2da23516ce16f603b716586dcb21db5b03784626 (patch)
treee273ca74872c86d4c37c8f0dbca0e0f2d095483b /include
parentb6a813b79253862a2f0a01de8cc45740acbb00b5 (diff)
downloadbdwgc-2da23516ce16f603b716586dcb21db5b03784626.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.
Diffstat (limited to 'include')
-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 80afdec2..286bf179 100644
--- a/include/private/gc_pmark.h
+++ b/include/private/gc_pmark.h
@@ -224,7 +224,8 @@ GC_INLINE mse * GC_push_obj(ptr_t obj, hdr * hhdr, mse * mark_stack_top,
# 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)