Re: RFR 8201867: Kerberos keytabs with holes in certain places are parsed incorrectly

2018-05-16 Thread Weijun Wang


> On May 17, 2018, at 6:43 AM, Valerie Peng  wrote:
> 
> 
> Looking at the BufferedInputStream impl, it looks like its skip(...) method 
> should trigger the internal array to be refilled when the internal bytes are 
> used up. Maybe something like below would also work?

Looks so. I'll use your code.

Thanks
Max

> while (n > 0) {
>   int n2 = skip(n);
>   if (n2 == 0) {
> 
>   throw new IOException("Premature EOF reached");
>   } else {
>   n -= n2;
>   }
> }
> 
> Valerie
> 
> 
> On 4/24/2018 7:42 AM, Weijun Wang wrote:
>> Please take a review at
>> 
>>   
>> http://cr.openjdk.java.net/~weijun/8201867/webrev.00/
>> 
>> 
>> When the hole in keytab is right on the 8192 buffer boundary, skip(n) does 
>> not return n.
>> 
>> I are not sure if I can do something like "while (i < n) i += skip(n)" 
>> because skip(n) can return zero and it does not understand EOF. Therefore I 
>> readNBytes(n) and discard the result. If you have a better solution, I'll be 
>> happy to know.
>> 
>> Thanks
>> Max
>> 
>> 
> 



Re: RFR 8201867: Kerberos keytabs with holes in certain places are parsed incorrectly

2018-05-16 Thread Valerie Peng


Looking at the BufferedInputStream impl, it looks like its skip(...) 
method should trigger the internal array to be refilled when the 
internal bytes are used up. Maybe something like below would also work?


    while (n > 0) {
int n2 = skip(n);
if (n2 == 0) {throw new IOException("Premature EOF reached"); } else { 
n -= n2; } }

Valerie



On 4/24/2018 7:42 AM, Weijun Wang wrote:

Please take a review at

   http://cr.openjdk.java.net/~weijun/8201867/webrev.00/

When the hole in keytab is right on the 8192 buffer boundary, skip(n) does not 
return n.

I are not sure if I can do something like "while (i < n) i += skip(n)" because 
skip(n) can return zero and it does not understand EOF. Therefore I readNBytes(n) and 
discard the result. If you have a better solution, I'll be happy to know.

Thanks
Max





Re: RFR 8201867: Kerberos keytabs with holes in certain places are parsed incorrectly

2018-05-14 Thread Valerie Peng


I will take a look in a day or two if no one else get to it.

Valerie


On 4/24/2018 7:42 AM, Weijun Wang wrote:

Please take a review at

   http://cr.openjdk.java.net/~weijun/8201867/webrev.00/

When the hole in keytab is right on the 8192 buffer boundary, skip(n) does not 
return n.

I are not sure if I can do something like "while (i < n) i += skip(n)" because 
skip(n) can return zero and it does not understand EOF. Therefore I readNBytes(n) and 
discard the result. If you have a better solution, I'll be happy to know.

Thanks
Max





Re: RFR 8201867: Kerberos keytabs with holes in certain places are parsed incorrectly

2018-05-08 Thread Weijun Wang
Ping again. Thanks.

> On Apr 24, 2018, at 10:42 PM, Weijun Wang  wrote:
> 
> Please take a review at
> 
>  http://cr.openjdk.java.net/~weijun/8201867/webrev.00/
> 
> When the hole in keytab is right on the 8192 buffer boundary, skip(n) does 
> not return n.
> 
> I are not sure if I can do something like "while (i < n) i += skip(n)" 
> because skip(n) can return zero and it does not understand EOF. Therefore I 
> readNBytes(n) and discard the result. If you have a better solution, I'll be 
> happy to know.
> 
> Thanks
> Max
> 



RFR 8201867: Kerberos keytabs with holes in certain places are parsed incorrectly

2018-04-24 Thread Weijun Wang
Please take a review at

  http://cr.openjdk.java.net/~weijun/8201867/webrev.00/

When the hole in keytab is right on the 8192 buffer boundary, skip(n) does not 
return n.

I are not sure if I can do something like "while (i < n) i += skip(n)" because 
skip(n) can return zero and it does not understand EOF. Therefore I 
readNBytes(n) and discard the result. If you have a better solution, I'll be 
happy to know.

Thanks
Max