I got a simple question, if range checking is turned off in the compiler options and some code in a program is reading (not writing) beyond an array's or string bounds, for example array[index] where index is one higher than the length of the array, can only that read operation produce access violations ?
I think it can but i'm not 100% certain. For example when the end of the allocated array's memory is located just at the edge / border of our programs allocted memory and just near it sits memory from another application. Or wouldn't this in general produce an access violation.
The reason i'm asking is that range checking had been turned for years in our code and i just turned it on in a debug version for me to test with to find out that there are a few places were our code reads 1 element beyond the arrays index. If range checking is turned on you'll get a range check exception here but if it's turned off it seems to work without a problem. I know writing there will produce memory corruption but i'm just wondering if this can produce access violations at some point if the memory is just being read. I'd like to know since we are in the process of tracing an annoying access violation that happens with clients, which we can't reproduce and has no stack trace and the memory address of the EIP and accessed memory seems to lie beyond our programs memory limits.I wonder if we should focus on the those kind of range check errors or not to trace down that access violation, since the range checking system only mentions them when we actually go out of range. So there might be more code that does it which we haven't seen yet. (Just to be clear, the places where it did happen i already changed the code to prevent it from happening, but there might be other places where it happens)