Various ASan fixes
Some of these commits still have my notes in them as an aid to reviewers, I will of course remove them once we decide the changes are correct. I'm pretty confident in most of the changes, least confident in the commit marked WIP...
Edited by Sean McBride