mirror of
https://github.com/encounter/bdwgc.git
synced 2026-03-30 10:57:55 -07:00
Fix hbp overflow in GC_install_counts
Issue #245 (bdwgc). The overflow resulted in an infinite loop in GC_install_counts on Win32. * headers.c (GC_install_counts): If hbp+=BOTTOM_SZ overflow is expected then break the first loop.
This commit is contained in:
@@ -284,6 +284,8 @@ GC_INNER GC_bool GC_install_counts(struct hblk *h, size_t sz/* bytes */)
|
||||
|
||||
for (hbp = h; (word)hbp < (word)h + sz; hbp += BOTTOM_SZ) {
|
||||
if (!get_index((word) hbp)) return(FALSE);
|
||||
if ((word)hbp > (~(word)0) - (word)BOTTOM_SZ * HBLKSIZE)
|
||||
break; /* overflow */
|
||||
}
|
||||
if (!get_index((word)h + sz - 1)) return(FALSE);
|
||||
for (hbp = h + 1; (word)hbp < (word)h + sz; hbp += 1) {
|
||||
|
||||
Reference in New Issue
Block a user