Skip to content

Commit

Permalink
Fix GC_is_visible for case of arg pointing exactly to object upper bound
Browse files Browse the repository at this point in the history
(a cherry-pick of commit e8fa865 from 'master')

In the single-threaded configuration of the collector, if p points
exactly to base of the object plus its length then treat is a pointer
outside the object (this behavior is similar to that of a bitmap-based
descriptor).

* ptr_chck.c [!THREADS] (GC_is_visible): If descr is length-based and
p-base==descr then fail.
  • Loading branch information
ivmai committed Sep 4, 2024
1 parent 423e316 commit 3c3b2aa
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion ptr_chck.c
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ GC_API void * GC_CALL GC_is_visible(void *p)
retry:
switch(descr & GC_DS_TAGS) {
case GC_DS_LENGTH:
if ((word)p - (word)base > descr) goto fail;
if ((word)p - (word)base >= descr) goto fail;
break;
case GC_DS_BITMAP:
if ((word)p - (word)base >= WORDS_TO_BYTES(BITMAP_BITS)
Expand Down

0 comments on commit 3c3b2aa

Please sign in to comment.