Compare the buffer pointers to avoid signedness mismatches.
Previously, this code tried to traffick in buffer sizes. It seems
that the results of the pointer arithmetic resulted in a signed value
while the buffer size constant was interpreted as an unsigned.
Change-Id: I1816fee9eae36f225d0480642ecc91ea7a2d0ad1
diff --git a/vm/alloc/HeapBitmap.c b/vm/alloc/HeapBitmap.c
index 3ec5ab1..c5f3d18 100644
--- a/vm/alloc/HeapBitmap.c
+++ b/vm/alloc/HeapBitmap.c
@@ -123,7 +123,7 @@
}
/* Make sure that there are always enough slots available */
/* for an entire word of 1s. */
- if (NELEM(pointerBuf) - (pb - pointerBuf) < HB_BITS_PER_WORD) {
+ if (pb >= &pointerBuf[NELEM(pointerBuf) - HB_BITS_PER_WORD]) {
(*callback)(pb - pointerBuf, pointerBuf, callbackArg);
pb = pointerBuf;
}