Merge "Fix possible arithmetic overflow when setting a timeout"
This commit is contained in:
commit
8b749f7de5
|
@ -385,7 +385,8 @@ private String readStringLongTimeout() throws IOException {
|
|||
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…
Reference in New Issue