Uploaded image for project: 'Harmony'
  1. Harmony
  2. HARMONY-6361

[JDWP][Java6] Fix a problem that will result in crash if OOM happens

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 6.0M1
    • JDK
    • None
    • Patch Available

    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.

      Attachments

        1. HARMONY-6361.diff
          3 kB
          Jim Yu

        Activity

          People

            odeakin Oliver Deakin
            junjie0122 Jim Yu
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: