cheneygc: Fix heap overflow detection for unsigned os_vm_size_t
commit6c62a086377b66ff6c69cb347f646743c4f05a0b
authorAlastair Bridgewater <alastair.bridgewater@gmail.com>
Sun, 22 Nov 2015 21:13:02 +0000 (22 16:13 -0500)
committerAlastair Bridgewater <alastair.bridgewater@gmail.com>
Mon, 30 Nov 2015 20:06:41 +0000 (30 15:06 -0500)
treedb0d9584ef21f8e11b13a99814a3d65f9053d4e9
parent14c6d94ef6800fda929aa8ef4926a1e74cceb4fb
cheneygc: Fix heap overflow detection for unsigned os_vm_size_t

  * Instead of checking to see if the overall size of the trigger
area (unused part of a dynamic space) is negative, check first to
see if it would BE negative if the operation were to be performed,
allowing the high-water detection to occur even if os_vm_size_t is
unsigned (thus, not having any negative values).

  * As a practical upshot, this means that we get a sane error
message when we run out of heap space, instead of either silently
doing something stupidly wrong or having a rather opaque message
about mprotect() failing and various advice that applies to gencgc
but not cheneygc.
src/runtime/cheneygc.c