When you access an array out of bounds, for example:
int numbers[2];
numbers[2] = 12345; // here we are accessing the array out of bounds
Is the above considered a violation of type safety or a violation of memory safety?
Or is it a violation of both? the reason why I think it may be a violation of both is because this article may be saying that memory safety is a subset of type safety:
C and C++: not type safe. C’s standard type system does not rule out programs that the standard (and common practice) considers meaningless, e.g., programs that write off the end of a buffer. 1 So, for C, well typed programs can go wrong. C++ is (morally) a superset of C, and so it inherits C’s lack of type safety.
The article also have the following note for the 1 above:
C is also not memory safe; in effect, the undefined behaviors that memory safety rules out are a subset of the undefined behaviors ruled out by type safety.