Microsoft's Application Verifier is a great tool for diagnosing lots of problems (on Windows mind you) including doing verification on your not overflowing bounds. Best part is you don't even have to change your code or recompile, it does completely run-time diagnostics.
http://www.microsoft.com/technet/prodtechnol/windo ws/appcompatibility/appverifier.mspx
For the memory validation, every time you allocate memory it'll put it in it's own page with guard pages around it such that if you write past your buffers even by a single byte you'll immmediately AV inside the offending code (rather than crashing later on in some unrelated code or inside the heap manager).
Dead simple to use, and has saved me countless hours. A similar tool is the Driver Verifier, which is actually included with most releases of Windows under C:\Windows\System32\verifier.exe. It does essentially the same kinds of things but for drivers, so if you've been getting lots of blue screens with stuff like BAD_POOL_HEADER etc, run verifier, wait a few minutes for the driver to do it's dirty deed, and take a look at the crash dump to see which driver is to blame.
Microsoft's Application Verifier is a great tool for diagnosing lots of problems (on Windows mind you) including doing verification on your not overflowing bounds. Best part is you don't even have to change your code or recompile, it does completely run-time diagnostics. http://www.microsoft.com/technet/prodtechnol/windo ws/appcompatibility/appverifier.mspx
For the memory validation, every time you allocate memory it'll put it in it's own page with guard pages around it such that if you write past your buffers even by a single byte you'll immmediately AV inside the offending code (rather than crashing later on in some unrelated code or inside the heap manager).
Dead simple to use, and has saved me countless hours. A similar tool is the Driver Verifier, which is actually included with most releases of Windows under C:\Windows\System32\verifier.exe. It does essentially the same kinds of things but for drivers, so if you've been getting lots of blue screens with stuff like BAD_POOL_HEADER etc, run verifier, wait a few minutes for the driver to do it's dirty deed, and take a look at the crash dump to see which driver is to blame.