Fixes bug where code occasionally tried to write over the end of the output buffer.
Fixes bug where code occasionally tried to write over the end of the output buffer.

nh13/picard,alecw/picard,nh13/picard,broadinstitute/picard,broadinstitute/picard,annkupi/picard,alecw/picard,annkupi/picard,alecw/picard,annkupi/picard,nh13/picard,broadinstitute/picard,broadinstitute/picard,annkupi/picard,nh13/picard,alecw/picard,broadinstitute/picard