So I'm playing around in VS2022 with /fsanitize=address but I fail to understand how is this useful if it only catches only a small number of out of bounds accesses.
For instance, this simple program works fine:
int main()
{
unsigned char arr[2] = { 0xAA, 0xAB };
arr[255] = 4;
}
Is there something I'm missing? I see that small indexes like arr[2] do trigger address sanitizer errors. Is there a way to configure the limits of the address sanitizer?
Context: I discovered a bug in my C program where I would index an array using a variable which is wrongly reset to 0xFF under certain circumstances but none of my ~300 tests detect this. I thought the address sanitizer would detect it but it seems I'm wrong.