Browse Source

Merge "Fix possible arithmetic overflow when setting a timeout"

stable-4.3
Shawn Pearce 9 years ago committed by Gerrit Code Review @ Eclipse.org
parent
commit
8b749f7de5
  1. 3
      org.eclipse.jgit/src/org/eclipse/jgit/transport/BasePackPushConnection.java

3
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);

Loading…
Cancel
Save