aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShawn Pearce <spearce@spearce.org>2015-12-15 23:16:19 -0500
committerGerrit Code Review @ Eclipse.org <gerrit@eclipse.org>2015-12-15 23:16:21 -0500
commit8b749f7de5882f8098be9d391b15e80b66e089e6 (patch)
tree01b48d2a767501dec0c50927585b6ea0159b6c0a
parentfcd796a9a075478f65087e0cf212d93390a75076 (diff)
parent310e858f818405d6ad4b9758f22abebd26d0ea88 (diff)
downloadjgit-8b749f7de5882f8098be9d391b15e80b66e089e6.tar.gz
jgit-8b749f7de5882f8098be9d391b15e80b66e089e6.zip
Merge "Fix possible arithmetic overflow when setting a timeout"
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/transport/BasePackPushConnection.java3
1 files changed, 2 insertions, 1 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/BasePackPushConnection.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/BasePackPushConnection.java
index 4499f66d53..963de35d41 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/BasePackPushConnection.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/BasePackPushConnection.java
@@ -385,7 +385,8 @@ public abstract class BasePackPushConnection extends BasePackConnection implemen
final int oldTimeout = timeoutIn.getTimeout();
final int sendTime = (int) Math.min(packTransferTime, 28800000L);
try {
- timeoutIn.setTimeout(10 * Math.max(sendTime, oldTimeout));
+ int timeout = 10 * Math.max(sendTime, oldTimeout);
+ timeoutIn.setTimeout((timeout < 0) ? Integer.MAX_VALUE : timeout);
return pckIn.readString();
} finally {
timeoutIn.setTimeout(oldTimeout);