diff options
author | Ivan Maidanski <ivmai@mail.ru> | 2016-12-10 02:07:25 +0300 |
---|---|---|
committer | Ivan Maidanski <ivmai@mail.ru> | 2016-12-10 02:07:25 +0300 |
commit | bfeaf865a4f87791d3fafcf51bac5eb04e6cc072 (patch) | |
tree | d15aadc8c347777fa46295f6db5bf05f3860f13b /mark.c | |
parent | fbdd97254de38951a859e9a96cf08f77435bb05a (diff) | |
download | bdwgc-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.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -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) |