Unfortunately, easily corrected it is not. Yes, probably >95% of arrays have a nearby easily-accessible length parameter that indicates their maximum legal length (excluding the security disaster of null-terminate strings). But the problem is there's no consistent way that people do this. Sometimes people put pointer first and size second, sometimes it's the other way around. Sometimes the size is a size_t, sometimes an unsigned, sometimes an int. Or sometimes it's not a pointer-and-size, but pointer and one-past-the-end pointer pair. Sometimes multiple arrays share the same size parameter.
So instead of an easy solution getting you 90% for effectively free, you get like 30% with the easy solution, and have to make it more complicated to handle the existing diversity to push it back up to that 90%.
Do you have a source for this? I thought it was use after free.
Out of bounds write and read are more prevalent then UAF. There are multiple types of bugs that can produce OOB read or write though.
And add slice and buffer typedefs to the standard library. Especially since they added counted_by to the language.
Add a way to define a slice the points to a c string.
It's so easy that thousands of developers trying for 40+ years haven't been able to do it yet.