[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Classpath-inetlib] Possible bug in gnu.inet.util.BASE64
From: |
Chris Burdess |
Subject: |
Re: [Classpath-inetlib] Possible bug in gnu.inet.util.BASE64 |
Date: |
Mon, 11 Jan 2010 07:54:28 +0000 |
Jorge Barreiro wrote:
> I've checked the CVS head code and I've found the error: the length of the
> target array was wrong. I've checked the history of this class too. It seems
> that this issue was already detected, but the fix was wrong and was reverted.
>
> I attach my patch (base64len.patch), which corrects the length of the target
> array (so there's no need to truncate, I've removed that code), and
> uncommented the code to fill with padding simbols again.
>
> The second patch (base64dec.patch) is for the decode function. That function
> works ok, but I detected something odd with the target array length. First, a
> buffer with an arbitrary length is created, then it's truncated to the
> correct size. But the length of the target array can be known beforehand,
> there's no need to truncate the array at the end.
>
> With this patch, the method will throw an arrayoutofindex exception if the
> given array length is not divisible by 4, which I think is ok, since the
> result would be incorrect.
>
> Please, let me know if you are going to apply the patch (specially the first
> one).
I applied both of these to HEAD, thank you very much. I agree that throwing an
exception is fine in the case you describe.
--
Chris Burdess