throw ArithmeticException on integer overflow from size

Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
This commit is contained in:
Lachlan Roberts 2020-12-01 09:51:09 +11:00
parent a51b5db209
commit 602cd7e5c0
1 changed files with 1 additions and 1 deletions

View File

@ -59,7 +59,7 @@ public class ByteBufferAccumulator implements AutoCloseable
{
int length = 0;
for (ByteBuffer buffer : _buffers)
length += buffer.remaining();
length = Math.addExact(length, buffer.remaining());
return length;
}