SCUDO_DEBUG was not enabled for unit tests, meaning the DCHECKs
were never tripped. While turning this on, I discovered that a few
of those not-exercised checks were actually wrong. This CL addresses
those incorrect checks.
Not that to work in tests CHECK_IMPL has to explicitely use the
scudo namespace. Also changes a C cast to a C++ cast.