Uploaded image for project: 'Commons Codec'
  1. Commons Codec
  2. CODEC-102

Base64OutputStream can miss last byte

    XMLWordPrintableJSON

    Details

      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);
      }

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              doom777 Ephraim Khantsis
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - 1m
                1m
                Remaining:
                Remaining Estimate - 1m
                1m
                Logged:
                Time Spent - Not Specified
                Not Specified