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

Incorrect instance to dispose

    XMLWordPrintable

    Details

    • Subcomponent:
    • Introduced In Version:
      11
    • Resolved In Build:
      b24

      Backports

        Description

        Here is the original bug report: https://mail.openjdk.java.net/pipermail/security-dev/2021-October/027805.html.
        -------------
        During routine examination of thread dumps I noticed a stack trace you
        may find interesting. Relevant part:

          java.lang.Thread.State: RUNNABLE
        ...
        at java.lang.IllegalStateException.<init>(java.base@11.0.11/Unknown Source)
        at javax.crypto.Cipher.checkCipherState(java.base@11.0.11/Unknown Source)
        at javax.crypto.Cipher.doFinal(java.base@11.0.11/Unknown Source)
        at sun.security.ssl.SSLCipher$T12GcmReadCipherGenerator$GcmReadCipher.dispose(java.base@11.0.11/Unknown
        Source)
        at sun.security.ssl.InputRecord.changeReadCiphers(java.base@11.0.11/Unknown
        Source)
        at sun.security.ssl.ChangeCipherSpec$T10ChangeCipherSpecConsumer.consume(java.base@11.0.11/Unknown
        Source)
        ...

        All handshakes that negotiate GCM ciphers throw and catch an
        exception, because the newly created cipher is disposed before use.

        I believe this is caused by this line of code:
        https://github.com/openjdk/jdk/blob/739769c8fc4b496f08a92225a12d07414537b6c0/src/java.base/share/classes/sun/security/ssl/InputRecord.java#L125

        I think it should read as follows:
        this.readCipher.dispose();

          Attachments

            Issue Links

              Activity

                People

                Assignee:
                xuelei Xuelei Fan
                Reporter:
                xuelei Xuelei Fan
                Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                  Dates

                  Created:
                  Updated:
                  Resolved: