bug-classpath
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug classpath/25154] New: Infinite recursion is occurred when SecurityM


From: freebeans at xqb dot biglobe dot ne dot jp
Subject: [Bug classpath/25154] New: Infinite recursion is occurred when SecurityManager is set
Date: 29 Nov 2005 15:36:55 -0000

When SecurityManager is set, Class.getClassLoader() falls into infinite
recursion.
Class.getClassLoader() -> VMStackWalker.getCallingClassLoader() ->
Class.getClassLoader() -> ...

VMStackWalker.getCallingClassLoader() calls Class.getClassLoader()
---
  public static ClassLoader getCallingClassLoader()
  {
    Class[] ctx = getClassContext();
    if (ctx.length < 3)
      return null;
    return ctx[2].getClassLoader();
  }
---
Class.getClassLoader() calls VMStackWalker.getCallingClass() when
SecurityManager is set.
---
  public ClassLoader getClassLoader()
  {
    if (isPrimitive())
      return null;

    ClassLoader loader = VMClass.getClassLoader(this);
    // Check if we may get the classloader
    SecurityManager sm = SecurityManager.current;
    if (sm != null)
      {
        // Get the calling classloader
        ClassLoader cl = VMStackWalker.getCallingClassLoader();
        if (cl != null && !cl.isAncestorOf(loader))
          sm.checkPermission(new RuntimePermission("getClassLoader"));
      }
    return loader;
  }
---


-- 
           Summary: Infinite recursion is occurred when SecurityManager is
                    set
           Product: classpath
           Version: 0.19
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: classpath
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: freebeans at xqb dot biglobe dot ne dot jp


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25154





reply via email to

[Prev in Thread] Current Thread [Next in Thread]