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

AccessController.doPrivileged() doesn't check parameter type

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P4 P4
    • None
    • 8u241, 11.0.6
    • hotspot

      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

            Unassigned Unassigned
            aleonard Andrew Leonard
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: