This is an automated email from the ASF dual-hosted git repository. aherbert pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/commons-codec.git
commit f19ec7891da4f591910e3a28d6ba87c6bbacba38 Author: Adam Retter <adam.ret...@googlemail.com> AuthorDate: Sat Apr 18 23:23:05 2020 +0200 Bugfix - buffer must always hold at least 'size' bytes --- src/main/java/org/apache/commons/codec/binary/BaseNCodec.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/apache/commons/codec/binary/BaseNCodec.java b/src/main/java/org/apache/commons/codec/binary/BaseNCodec.java index bd1d7c2..33f9916 100644 --- a/src/main/java/org/apache/commons/codec/binary/BaseNCodec.java +++ b/src/main/java/org/apache/commons/codec/binary/BaseNCodec.java @@ -567,7 +567,7 @@ public abstract class BaseNCodec implements BinaryEncoder, BinaryDecoder { */ protected byte[] ensureBufferSize(final int size, final Context context){ if (context.buffer == null) { - context.buffer = new byte[getDefaultBufferSize()]; + context.buffer = new byte[Math.max(size, getDefaultBufferSize())]; context.pos = 0; context.readPos = 0;