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

AccessController.doPrivileged() doesn't check parameter type

    Details

    • Type: Bug
    • Status: New
    • Priority: P4
    • Resolution: Unresolved
    • Affects Version/s: 8u241, 11.0.6
    • Fix Version/s: None
    • Component/s: hotspot

      Description

      When passing a PrivilegedExceptionAction object to AccessController.doPrivileged(PrivilegedAction<T> action), a java.lang.IncompatibleClassChangeError is expected.

      Following jasm testcase can reveal the problem:

      super public class a/se/java_security/MydoPriv
                 version 52:0
      {
          public Method "<init>":"()V" stack 1 locals 1 {
              aload_0;
              invokespecial Method a/se/java_security/MydoPriv."<init>":"()V";
              return;
          }

          public static Method method:"()Ljava/lang/String;" stack 16 locals 4 {
              invokestatic Method a/se/java_security/TestRIAccdoPriv."getPEA":"()Ljava/security/PrivilegedExceptionAction;";
              invokestatic Method java/security/AccessController."doPrivileged":"(Ljava/security/PrivilegedAction;)Ljava/lang/Object;";
              ldc String "FAILED: this should NOT be called";
              areturn;
          }
      }

      Output:
      openjdk version "1.8.0_242"
      OpenJDK Runtime Environment (AdoptOpenJDK)(build 1.8.0_242-202001200720-b08)
      OpenJDK 64-Bit Server VM (AdoptOpenJDK)(build 25.242-b08, mixed mode)

      FAILED: this should NOT be called

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              aleonard Andrew Leonard
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated: