This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug java/33789] New: gij crashes when sending serialized objects through a pipe


I can crash gij when I read multiple serialized objects (type does not matter)
from a PipedInputStream.  You can reproduce the bug with the following small
example:

public class Test {
    public static void main(String[] args) throws Throwable {
        java.io.PipedOutputStream mout = new java.io.PipedOutputStream();
        new Reader(new java.io.PipedInputStream(mout)).start();
        java.io.ObjectOutputStream os = new java.io.ObjectOutputStream(mout);
        for (int i = 0; i < 1000; ++i)
            os.writeObject(new Integer(1));
    }

    static class Reader extends Thread {
        java.io.PipedInputStream pin;
        Reader(java.io.PipedInputStream in) {
            pin = in;
        }
        public void run() {
            try {
                java.io.ObjectInputStream  is =
                    new java.io.ObjectInputStream(pin);
                for (int i = 0; i < 1000; ++i)
                    is.readObject();
            } catch (Exception t) {
                System.err.println("Exception: " + t);
                System.exit(1);
            }
        }
    }
}

It does not matter whether you compile this with gcj or the Sun Java compiler
thus the compiler is obviously not the problem.

Running this in gij with

gij Test

leads to a random exception.  Running the same code in the Sun JVM does not
cause any problems.

This is tested with the current SVN tree (trunk revision 129368) and with
several released versions as shipped with various Linux distributions (tested
on Redhat/Fedora and SUSE).


-- 
           Summary: gij crashes when sending serialized objects through a
                    pipe
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: java
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: rschiele at gmail dot com
 GCC build triplet: x86_64-unknown-linux-gnu
  GCC host triplet: x86_64-unknown-linux-gnu
GCC target triplet: x86_64-unknown-linux-gnu


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]