summaryrefslogtreecommitdiff
path: root/mark.c
diff options
context:
space:
mode:
authorIvan Maidanski <ivmai@mail.ru>2016-12-10 02:07:25 +0300
committerIvan Maidanski <ivmai@mail.ru>2016-12-10 02:07:25 +0300
commitbfeaf865a4f87791d3fafcf51bac5eb04e6cc072 (patch)
treed15aadc8c347777fa46295f6db5bf05f3860f13b /mark.c
parentfbdd97254de38951a859e9a96cf08f77435bb05a (diff)
downloadbdwgc-bfeaf865a4f87791d3fafcf51bac5eb04e6cc072.tar.gz
Workaround 'index out of bounds' UBSan false warning in push_marked
* mark.c (GC_push_marked): Cast (h+1)->hb_body to word before subtraction of sz value (and cast the result back to ptr_t). * mark.c [ENABLE_DISCLAIM] (GC_push_unconditionally): Likewise.
Diffstat (limited to 'mark.c')
-rw-r--r--mark.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/mark.c b/mark.c
index 8b776f57..167fa5af 100644
--- a/mark.c
+++ b/mark.c
@@ -1797,7 +1797,7 @@ STATIC void GC_push_marked(struct hblk *h, hdr *hhdr)
if (sz > MAXOBJBYTES) {
lim = h -> hb_body;
} else {
- lim = (h + 1)->hb_body - sz;
+ lim = (ptr_t)((word)(h + 1)->hb_body - sz);
}
switch(BYTES_TO_GRANULES(sz)) {
@@ -1856,7 +1856,7 @@ STATIC void GC_push_marked(struct hblk *h, hdr *hhdr)
if (sz > MAXOBJBYTES)
lim = h -> hb_body;
else
- lim = (h + 1)->hb_body - sz;
+ lim = (ptr_t)((word)(h + 1)->hb_body - sz);
GC_mark_stack_top_reg = GC_mark_stack_top;
for (p = h -> hb_body; (word)p <= (word)lim; p += sz)