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

Infinite recursion crashes jvm

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • 1.2.0
    • hotspot
    • generic
    • generic



      Name: vi73552 Date: 03/20/99


      import java.io.*;
      import java.net.*;

      /**
         The following code results in an endless recursive loop. However, it
         doesn't produce a StackOverflowError as you would expect, and crashes
         the JVM.

         javac bug.java ; java -Djava.compiler=NONE bug

         In addition, it causes the following error in the symantec JIT when it
         is enabled:

         A nonfatal internal JIT (3.00.078(x)) error 'Structured Exception(c00000fd)' has occurred in :
         'bug$M.m ()V': Interpreting method.
         Please report this error in detail to http://java.sun.com/cgi-bin/bugreport.cgi

      */

      //----------------------------------------------------------------------------

      public final class bug
      {
         public static void main(String args[])
         {
            System.out.println("main called");
            System.out.flush();

            if (System.getSecurityManager()!=null)
            {
               System.out.println("Can't set security manager");
               System.exit(-1);
            }
            
            System.setSecurityManager(new M());

            System.out.println("#args="+args.length);
            System.out.flush();
         }

         private static final class M extends SecurityManager
         {
            private synchronized void m()
            {
               System.out.println("getting call stack...");
               System.out.flush();

               Class[] s=getClassContext();

               for (int i=0 ; i<s.length ; i++)
               {
                  System.out.print("s["+i+"]="+s[i].getName());
                  System.out.flush();
               }
            }

            public void checkCreateClassLoader() {}
            public void checkAccess(Thread g) {}
            public void checkAccess(ThreadGroup g) {}
            public void checkExit(int status) {}
            public void checkExec(String cmd) {}
            public void checkLink(String lib) {}
            public void checkRead(FileDescriptor fd) {}
            public void checkRead(String file) {}
            public void checkRead(String file, Object context) {}
            public void checkWrite(FileDescriptor fd) {}
            public void checkWrite(String file) {}
            public void checkDelete(String file) {}
            public void checkConnect(String host, int port) {}
            public void checkConnect(String host, int port, Object context) {}
            public void checkListen(int port) {}
            public void checkAccept(String host, int port) {}
            public void checkMulticast(InetAddress maddr) {}
            public void checkMulticast(InetAddress maddr, byte ttl) {}
            public void checkPropertiesAccess() {}
            public void checkPropertyAccess(String key) {}
            public void checkPropertyAccess(String key, String def) {}
            public boolean checkTopLevelWindow(Object window) { return true; }
            public void checkPrintJobAccess() {}
            public void checkSystemClipboardAccess() {}
            public void checkAwtEventQueueAccess() {}
            public void checkSetFactory() {}
            public void checkPackageDefinition(String pkg) {}
            public void checkSecurityAccess(String provider) {}
            public void checkMemberAccess(Class clazz, int which) {}

            public void checkPackageAccess(String pkg) { m(); }
         }
      }
      (Review ID: 55841)
      ======================================================================

            apalanissunw Anand Palaniswamy (Inactive)
            vasya Vassili Igouchkine (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: