Poison freed objects such that double-free is detected
authorBehdad Esfahbod <behdad@behdad.org>
Sun, 30 Aug 2015 16:29:21 +0000 (17:29 +0100)
committerBehdad Esfahbod <behdad@behdad.org>
Sun, 30 Aug 2015 16:29:21 +0000 (17:29 +0100)
commit326b5ebf5748f547e4eb7388d66b79fe23130e2a
tree27c35bfbef8c91a5dc5fe42c022bb042b48853e2
parent6578575cc8aeb05341f2053039acfcd735707674
Poison freed objects such that double-free is detected

Previously we were setting refcount of freed objects to the inert value, which
was harmful because it caused further destroy()s of the freed object to NOT
call free() and hence hide the bug.  Indeed, after eb0bf3ae6688b7 test-object
was double-free'ing objects and this was never caught on Linux.  It only was
caught as crashing on Mac.

Now we poison refcount upon freeing and check that it's valid whenever reading
it.  Makes test-object fail now.
src/hb-object-private.hh