From 602cd7e5c0b613b17bfa7ca4a8a18874a07a2e6b Mon Sep 17 00:00:00 2001 From: Lachlan Roberts Date: Tue, 1 Dec 2020 09:51:09 +1100 Subject: [PATCH] throw ArithmeticException on integer overflow from size Signed-off-by: Lachlan Roberts --- .../main/java/org/eclipse/jetty/io/ByteBufferAccumulator.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jetty-io/src/main/java/org/eclipse/jetty/io/ByteBufferAccumulator.java b/jetty-io/src/main/java/org/eclipse/jetty/io/ByteBufferAccumulator.java index c352bcb5b82..c6bc659690f 100644 --- a/jetty-io/src/main/java/org/eclipse/jetty/io/ByteBufferAccumulator.java +++ b/jetty-io/src/main/java/org/eclipse/jetty/io/ByteBufferAccumulator.java @@ -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; }