Description
I found a problem in JDWP that will result in crash if OOM happens. In GetClassName() method of ClassManager class, we will use the return value of GetMemoryManager().Allocate() directly as a valid pointer to access the array element. But if the return value is invalid, crash will happen in no doubt. A possible case like that comes into my mind. In the implementation of GetMemoryManager().Allocate() method, we call jvmti method Allocate() to do the real work for the memory allocation. In normal case, the jvmti method works fine. But if the JVM memory runs out, it will certainly return OOM error code and the pointer passed to it to get the allocated memory address will be invalid. Then the crash would happen as I mentioned earlier. To prevent the potential crash problem for this case, I have got a fix to solve it.