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

Hashtable.hashCode causes stack overflow if hashtable was put into itself

    XMLWordPrintable

    Details

    • Type: Enhancement
    • Status: Closed
    • Priority: P2
    • Resolution: Fixed
    • Affects Version/s: 1.3.1_01
    • Fix Version/s: 1.3.1_01
    • Component/s: core-libs
    • Labels:
      None
    • Subcomponent:
    • Resolved In Build:
      01a
    • CPU:
      x86
    • OS:
      windows_nt
    • Verification:
      Verified

      Backports

        Description

                During our applet compatibility testing, we found a small amount
        of applets run into a problem in Hashtable.hashCode() and result in
                java.lang.StackOverflowError
                 at java.util.Hashtable$Entry.hashCode(Unknown Source)

                The issue is that these applets put the hashtable object into itself
        for some unknown reasons, and try to generate a hashCode. This causes
        the following code in java.util.Hashtable to execute:

            public synchronized int hashCode() {
                int h = 0;
                Iterator i = entrySet().iterator();
                while (i.hasNext())
                    h += i.next().hashCode();
                return h;
            }

                It will end up being a recursive call and cause stack overflow.
        These applets work fine in MS VM because M$'s implementation of hashCode()
        doesn't rely on the hashCode of the entries.

        URL: www.playsite.com
        Release: J2SE v1.3.1_01a, 1.4.
        Platform: Win32

          Attachments

            Issue Links

              Activity

                People

                Assignee:
                jjb Josh Bloch
                Reporter:
                stanleyh Stanley Ho (Inactive)
                Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                  Dates

                  Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: