harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Stepan Mishura" <stepan.mish...@gmail.com>
Subject Re: [classlib][security] HARMONY-5054 status was ([jira] Created: (HARMONY-5054) [ASN.1] BerInputStream will incorrectly resize buffer when the enveloped InputStream has lots of bytes)
Date Wed, 14 Nov 2007 17:13:39 GMT
On 11/14/07, Stepan Mishura <stepan.mishura@gmail.com> wrote:
<SNIP>
> > When decoding input from an inputStream retrieved from socket, the if
> > statement here is not adequate
> > to guarantee all the response bytes from server been collected.
> >
> > I doubt the off-line reproducer can unveal this bug. Correct if I am wrong.
> >
>
> I got the idea and going to try to create off-line reproducer by
> implementing custom InputStream.

Spark,

Does the test below model correctly your case?

        byte[] encoding = { 0x04, 0x0F, 0x01, 0x02,
                0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C,
                0x0D, 0x0E, 0x0F };

        // custom input stream that doesn't return all data at once
        ByteArrayInputStream in = new ByteArrayInputStream(encoding) {
            public int read(byte[] b, int off, int len) {
                if (len < 2) {
                    return super.read(b, off, len);
                } else {
                    return super.read(b, off, len - 1);
                }

            }
        };

        BerInputStream berIn = new BerInputStream(in);
        berIn.readContent();

Thanks,
Stepan.

Mime
View raw message