You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by ad...@apache.org on 2026/07/10 15:34:12 UTC

(wicket) branch master updated: guard against integer overflow in write() (#1443)

This is an automated email from the ASF dual-hosted git repository.

bitstorm pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/wicket.git


The following commit(s) were added to refs/heads/master by this push:
     new 629c696948 guard against integer overflow in write() (#1443)
629c696948 is described below

commit 629c69694890b1bf38b7e35b2151b83d41baa97f
Author: jmestwa-coder <jm...@gmail.com>
AuthorDate: Fri Jul 10 21:04:06 2026 +0530

    guard against integer overflow in write() (#1443)
---
 .../main/java/org/apache/wicket/util/io/ByteArrayOutputStream.java    | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/wicket-util/src/main/java/org/apache/wicket/util/io/ByteArrayOutputStream.java b/wicket-util/src/main/java/org/apache/wicket/util/io/ByteArrayOutputStream.java
index 228c910ab5..7d752243ca 100644
--- a/wicket-util/src/main/java/org/apache/wicket/util/io/ByteArrayOutputStream.java
+++ b/wicket-util/src/main/java/org/apache/wicket/util/io/ByteArrayOutputStream.java
@@ -172,6 +172,10 @@ public class ByteArrayOutputStream extends OutputStream
 			return;
 		}
 		int newcount = count + len;
+		if (newcount < 0)
+		{
+			throw new IndexOutOfBoundsException("Total size too large: " + newcount);
+		}
 		int remaining = len;
 		int inBufferPos = count - filledBufferSum;
 		while (remaining > 0)