Because your code has bugs and/or security vulnerabilities. It's pretty safe to assume this without looking at your code
Using a safer language makes it easier and less prone to out-of-bounds memory accesses.
By using C/C++ you're choosing to make a hard problem harder.
[1] shameless plug: https://github.com/duneroadrunner/SaferCPlusPlus
Oh and btw, "out of bounds memory accesses" are not the primary source of security vulnerabilities at all. In fact, such out of bounds access is more likely to just make your program crash (which is a good thing).
Software written in higher level languages is often less widely deployed, so less people are trying to find vulnerabilities. All the complexity adds up, and can result in new vulnerabilities that wouldn't have been there if the code was written in a simpler language.