summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvan Maidanski <ivmai@mail.ru>2021-12-01 07:50:20 +0300
committerIvan Maidanski <ivmai@mail.ru>2021-12-01 10:51:06 +0300
commitc89314fabb18185a9a733e75d06b5c4f9e255ac4 (patch)
tree28e1dd1d057fc218de673d6f8bdfa586f17af2cc
parent8f7f1c9200dd71fed78c6734ec1ec804eb584cf9 (diff)
downloadbdwgc-c89314fabb18185a9a733e75d06b5c4f9e255ac4.tar.gz
Workaround Thread Sanitizer (TSan) FP warning in is_valid_displacement
Issue #237 (bdwgc). * ptr_chck.c (GC_is_valid_displacement): Avoid passing NULL to HDR(p); add comment.
-rw-r--r--ptr_chck.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/ptr_chck.c b/ptr_chck.c
index 8b760af0..a4298a81 100644
--- a/ptr_chck.c
+++ b/ptr_chck.c
@@ -123,6 +123,11 @@ GC_API void * GC_CALL GC_is_valid_displacement(void *p)
word sz;
if (!EXPECT(GC_is_initialized, TRUE)) GC_init();
+
+ /* A quick check to avoid TSan report about the data race */
+ /* between GC_find_header() and GC_remove_counts(). */
+ if (NULL == p) return NULL;
+
hhdr = HDR((word)p);
if (hhdr == 0) return(p);
h = HBLKPTR(p);