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

java.io.FileOutputStream constructor does not work properly with null parameter

    XMLWordPrintable

Details

    • 1.1
    • sparc
    • solaris_2.5
    • Not verified

    Description

      This bug was found by St.Petersburg Java SQE team (by Alexander Kuzmin).


      The java.io.FileOutputStream.FileOutputStream(FileDescriptor) constructor
      does not work properly with null parameter.

      It creates new object but attempt to work with this stream
      causes 'segmantation violation' crash & core dump.

      _______________________Example___________________________

      import java.io.*;
      public class badtests {

        public static void main( String argv[] ) {

         FileDescriptor fd=null;
         FileOutputStream testfile=null;
       
          try {
          testfile=new FileOutputStream(fd);
          }
        catch (SecurityException e)
        {System.out.println("SecurityException - all OK !");}
        catch (Exception e)
        {System.out.println(" Unexpected "+e+" thrown ");}

         System.out.println("------------------------------");
         System.out.println("Exceptions not catched and..");
         System.out.println();
         System.out.println();

         try {
         testfile.write(100); // will cause crash
         } catch (Throwable e )
         {System.out.println(" Error :"+e);}
          System.out.println("All OK !");
          
        }

      }
      ______________________ Output ______________________________________
      Exceptions not catched and..


      SIGSEGV 11* segmentation violation
          si_signo [11]: SIGSEGV 11* segmentation violation
          si_errno [0]: Error 0
          si_code [1]: SEGV_ACCERR [addr: 0x0]

      stackbase=EFFFF524, stackpointer=EFFFDA08

      Full thread dump:
          "Finalizer thread" (TID:0xee3003b0, sys_thread_t:0xef490de0) prio=1
          "Async Garbage Collector" (TID:0xee300368, sys_thread_t:0xef4c0de0) prio=1
          "Idle thread" (TID:0xee300320, sys_thread_t:0xef4f0de0) prio=0
          "clock handler" (TID:0xee3001f8, sys_thread_t:0xef5b0de0) prio=11
          "main" (TID:0xee3000a0, sys_thread_t:0x76eb8) prio=5 *current thread*
      badtests.main(badtests.java:24)
      Monitor Cache Dump:
          unknown key (key=0xef4c0de0): unowned
      Waiting to be notified:
      "Async Garbage Collector"
      Registered Monitor Dump:
          Finalize me queue lock: unowned
      Waiting to be notified:
      "Finalizer thread"
          Thread queue lock: unowned
          Class lock: unowned
          Java stack lock: unowned
          Code rewrite lock: unowned
          Heap lock: unowned
          Has finalization queue lock: unowned
          Monitor IO lock: unowned
          Child death monitor: unowned
          Event monitor: unowned
          I/O monitor: unowned
          Alarm monitor: unowned
      Waiting to be notified:
      "clock handler"
          Sbrk lock: unowned
          Monitor cache lock: unowned
          Monitor registry: monitor owner: "main"
      Thread Alarm Q:
          sys_thread_t 0xef4c0de0 [Timeout in 824 ms]
      Abort
      ____________________________________________________________________
        

      david.a.brown@Eng 1996-12-10

      Attachments

        Activity

          People

            djbrown David Brown (Inactive)
            mgorshen Mikhail Gorshenev (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: