@@ -0,0 +1,2165 @@
+package ser;%0A%0Aimport java.io.ByteArrayInputStream;%0Aimport java.io.Externalizable;%0Aimport java.io.IOException;%0Aimport java.io.ObjectInput;%0Aimport java.io.ObjectOutput;%0A%0Aimport org.junit.Ignore;%0Aimport org.junit.Test;%0Aimport org.nustaq.serialization.FSTConfiguration;%0Aimport org.nustaq.serialization.FSTObjectInput;%0Aimport org.nustaq.serialization.FSTObjectOutput;%0A%0Apublic class OverflowTest %7B%0A%0A    @Test%0A    @Ignore%0A    public void test() throws Throwable %7B%0A        FSTConfiguration fc = FSTConfiguration.createDefaultConfiguration();%0A%0A        byte%5B%5D b;%0A        int len;%0A        try (FSTObjectOutput foo = new FSTObjectOutput(fc)) %7B%0A            foo.writeObject(new Outer());%0A            b = foo.getBuffer();%0A            len = foo.getWritten();%0A        %7D%0A        ByteArrayInputStream bais = new ByteArrayInputStream(b, 0, len);%0A        FSTObjectInput foi = fc.getObjectInput(bais);%0A        foi.readObject();%0A    %7D%0A%0A    // Up to about stream offset 16K there is this other table.  This needs to%0A    // be big enough to break past that and also produce enough stack frames to%0A    // overflow.%0A    private static final int OUTER_CT = 30000;%0A%0A    public static class Outer implements Externalizable %7B%0A        @Override%0A        public void writeExternal(ObjectOutput out) throws IOException %7B%0A            for (int i = 0; i %3C OUTER_CT; ++i) %7B%0A                out.writeObject(new Inner());%0A            %7D%0A        %7D%0A%0A        @Override%0A        public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException %7B%0A            for (int i = 0; i %3C OUTER_CT; ++i) %7B%0A                in.readObject();%0A            %7D%0A        %7D%0A    %7D%0A%0A    public static class Inner implements Externalizable %7B%0A        @Override%0A        public void writeExternal(ObjectOutput out) throws IOException %7B%0A            // An array of length 0 produces a period of 7 and we want to%0A            // target 23 which is the hash table size as picked up in the%0A            // debugger%0A            out.writeObject(new byte%5B16%5D);%0A        %7D%0A%0A        @Override%0A        public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException %7B%0A            in.readObject();%0A        %7D%0A    %7D%0A%7D%0A

Add test for objects that align poorly with FSTInt2ObjectMap