You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hc.apache.org by rs...@apache.org on 2026/01/31 02:19:54 UTC
(httpcomponents-core) branch 5.4.x updated: LaxConnPool: Prevent integer overflow in getTotalStats()
This is an automated email from the ASF dual-hosted git repository.
rschmitt pushed a commit to branch 5.4.x
in repository https://gitbox.apache.org/repos/asf/httpcomponents-core.git
The following commit(s) were added to refs/heads/5.4.x by this push:
new a33904a47 LaxConnPool: Prevent integer overflow in getTotalStats()
a33904a47 is described below
commit a33904a4761d04e841fbcd1732f0bcf3975e5093
Author: Ryan Schmitt <rs...@apache.org>
AuthorDate: Fri Jan 30 18:17:42 2026 -0800
LaxConnPool: Prevent integer overflow in getTotalStats()
---
httpcore5/src/main/java/org/apache/hc/core5/pool/LaxConnPool.java | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/httpcore5/src/main/java/org/apache/hc/core5/pool/LaxConnPool.java b/httpcore5/src/main/java/org/apache/hc/core5/pool/LaxConnPool.java
index c3e682b66..8370bc035 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/pool/LaxConnPool.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/pool/LaxConnPool.java
@@ -226,14 +226,14 @@ public PoolStats getTotalStats() {
int leasedTotal = 0;
int pendingTotal = 0;
int availableTotal = 0;
- int maxTotal = 0;
+ long maxTotal = 0;
for (final PerRoutePool<T, C> routePool : routeToPool.values()) {
leasedTotal += routePool.getLeasedCount();
pendingTotal += routePool.getPendingCount();
availableTotal += routePool.getAvailableCount();
maxTotal += routePool.getMax();
}
- return new PoolStats(leasedTotal, pendingTotal, availableTotal, maxTotal);
+ return new PoolStats(leasedTotal, pendingTotal, availableTotal, (int) Long.min(maxTotal, Integer.MAX_VALUE));
}
@Override