The simplest workaround would probably be to pad the encoded output to a multiple of 3 by adding 0, 1, or 2 ‘=’ characters as needed.

Eames, Andrew" <andrew@cognex.com> wrote:

But there is still the problem with running off the end of the source -
If the source is not a multiple of 3 bytes then the input iterator will
run off the end of the input sequence which can cause an error.

  Andrew