[Sanitizer] Fix a bug introduced in r196112. Add a test.