harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Spark Shen" <smallsmallor...@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 Thu, 15 Nov 2007 02:50:36 GMT
2007/11/15, Stepan Mishura <stepan.mishura@gmail.com>:
>
> 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();


Oh, Yes, I think so.

Thanks,
> Stepan.
>



-- 
Spark Shen
China Software Development Lab, IBM

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message