TrackingPolicy::Debug didn't store the base pointer of the Area, and instead relied on the first allocation to discover it, however, because of alignment, the first allocation may not match the base pointer. Because of that there could be an overflow in onRewind(), i.e. we could rewind to a pointer before the (wrongly computed) base. This overflow caused the debug memset to go awry and stomped on memory. This is fixed by passing the base pointer to the constructor of the TrackingPolicy. This base pointer could be nullptr with certain allocators, but in that case, onReset/onRewind should never be called; and this is enforced at compile time. Also fixed a (luckily) harmless buffer overflow when preparing the dynamic lights, if the number of lights wasn't a multiple of 4. This was harmless because we use a linear allocator, so overflows are not really overflows.
9.3 KiB
9.3 KiB