Undefined behaviour is undefined. Sometimes it can mean your program crashes. Sometimes it means some data gets corrupted in a way that doesn't crash your program. Sometimes it means that the program will appear to work.
If you write outside the bounds of the array, you will overwrite data at an address that may be being used for something else. You don't know what it's used for, and you don't know what the effect of overwriting it will be.
It's not really productive to worry about why the undefined behaviour manifests in a particular way, because that's down to the vagueries of your specific compiler. Just understand what you got wrong, and fix it.