Uploaded image for project: 'Harmony'
  1. Harmony
  2. HARMONY-5336

[classlib][luni] StackOverflow in DataInputStream.readUTF(DataInput)

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • None
    • None
    • Linux
    • Novice

    Description

      The following test leads to stack overflow on Harmony, but works ok on RI:
      import java.io.DataInput;
      import java.io.DataInputStream;
      import java.io.IOException;

      public class Test {
      public static void main(String[] args) throws Exception

      { new MyDataInputStream().readUTF(); }

      static class MyDataInputStream implements DataInput {
      public boolean readBoolean() throws IOException

      { return false; }

      public byte readByte() throws IOException

      { return (byte) 0; }

      public char readChar() throws IOException

      { return (char) 0; }

      public double readDouble() throws IOException

      { return 0.0; }

      public float readFloat() throws IOException

      { return (float) 0.0; }

      public void readFully(byte[] buffer) throws IOException {
      }

      public void readFully(byte[] buffer, int offset, int count)
      throws IOException {
      }

      public int readInt() throws IOException

      { return 0; }

      public String readLine() throws IOException { return null; }

      public long readLong() throws IOException { return (long) 0; }

      public short readShort() throws IOException { return (short) 0; }

      public int readUnsignedByte() throws IOException { return 0; }

      public int readUnsignedShort() throws IOException

      { return 0; }

      public String readUTF() throws IOException { return DataInputStream.readUTF(this); }

      public int skipBytes(int count) throws IOException { return 0; }

      }
      }

      readUTF(DataInput in) static method of DataInputStream just calls 'return in.readUTF();' which lead to this problem. I'll provide the patch soon.

      Attachments

        1. H-5336.patch
          3 kB
          Mikhail Markov

        Activity

          People

            mmarkov Mikhail Markov
            mmarkov Mikhail Markov
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: