You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Ephraim Khantsis (JIRA)" <ji...@apache.org> on 2010/06/14 16:12:17 UTC

[jira] Updated: (CODEC-102) Base64OutputStream can miss last byte

     [ https://issues.apache.org/jira/browse/CODEC-102?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Ephraim Khantsis updated CODEC-102:
-----------------------------------

     Original Estimate: 0.02h  (was: 168h)
    Remaining Estimate: 0.02h  (was: 168h)
           Environment:     (was: Not important)
           Description: 
Base64OutputStream misuses Base64.encode class. The documentation specifically says to call call encode with inAvail = -1, in order to signal Base64 that there is no more input, and it should wrap up the remaining bytes. Base64OutputStream does not do so, and as a result, last bytes can be missed.

My proposed fix is to add the following to beginning of Base64OutputStream#flush(boolean):
if (doEncode) {
   base64.encode(null, 0, -1);
}

  was:
Base64OutputStream misuses Base64.encode class. The documentation specifically says to call call encode with inAvail = -1, in order to signal Base64 that there is no more input, and it should wrap up the remaining bytes. Base64OutputStream does not do so, and as a result, last bytes can be missed.

My proposed fix is to add the following to beginning of Base64OutputStream.flush(boolean):
if (doEncode) {
   base64.encode(null, 0, -1);
}


> Base64OutputStream can miss last byte
> -------------------------------------
>
>                 Key: CODEC-102
>                 URL: https://issues.apache.org/jira/browse/CODEC-102
>             Project: Commons Codec
>          Issue Type: Bug
>    Affects Versions: 1.4
>            Reporter: Ephraim Khantsis
>   Original Estimate: 0.02h
>  Remaining Estimate: 0.02h
>
> Base64OutputStream misuses Base64.encode class. The documentation specifically says to call call encode with inAvail = -1, in order to signal Base64 that there is no more input, and it should wrap up the remaining bytes. Base64OutputStream does not do so, and as a result, last bytes can be missed.
> My proposed fix is to add the following to beginning of Base64OutputStream#flush(boolean):
> if (doEncode) {
>    base64.encode(null, 0, -1);
> }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.