Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6565795

Crash in AwtList::UpdateMaxItemWidth

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not an Issue
    • Icon: P4 P4
    • 8-pool
    • 7
    • client-libs
    • x86
    • windows

      There are two files attached to the bug report: a test that can be used to get a crash in AwtList, and the corresponding HotSpot log file. To reproduce the problem, just run the test and wait until it crashes.

      Looking at the code in AwtList::UpdateMaxItemWidth I found the following problematic lines:

          for ( int i=0; i < nCount; i++ )
          {
              jstring jstr = GetItemString( env, target, i );
              SIZE size = AwtFont::getMFStringSize( hDC, font, jstr );
              if ( size.cx > m_nMaxWidth )
                  m_nMaxWidth = size.cx;
              env->DeleteLocalRef( jstr );
          }

      GetItemString() is a method from AwtComponent that simply calls some Java method from the list target. As there is no synchronization between the Java list and its native object, it is possible that GetItemString() returns NULL value, so we should check it after the call.

      The bug exists in the AwtList code since at least 1.5, so this is not a recent regression.

            bagiras Oleg Pekhovskiy (Inactive)
            art Artem Ananiev (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: