Validity checks on pointers not working

Completely inexplicable values often indicate UB. However, it could also be that the debugger is simply showing you wrong values e.g. due to optimizations. I hope you are running a debug build? I would also recommend to log the values of the variables in question to make absolutely sure that you are getting correct readings.