Does Java have buffer overflows?
Since Java Strings are based on char arrays and Java automatically checks array bounds, buffer overflows are only possible in unusual scenarios:
- If you call native code via JNI
- In the JVM itself (usually written in C++)
- The interpreter or JIT compiler does not work correctly (Java bytecode mandated bounds checks)
Managed languages such as Java and C# do not have these problems, but the specific virtual machines (JVM/CLR/etc) which actually run the code may.