Switch to std::span and add 1 line to std::span::operator[] to check your bounds...
That's why I said add 1 line to std::span::operator[] to check your bounds.
I'm telling you to modify the STL header. It's a text file. Add 1 line to make it bounds-checked.