Merge pull request #505 from PascalSchumacher/potential_overflow_in_int_multiplication

Avoid potential overflow in int multiplication before it is converted…
This commit is contained in:
Jean-Baptiste Onofré 2020-05-16 07:17:13 +02:00 committed by GitHub
commit 0444dd96b2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 7 additions and 7 deletions

View File

@ -118,7 +118,7 @@ public class TransportStatusDetector implements Service, Runnable {
public void stop() throws Exception { public void stop() throws Exception {
started.set(false); started.set(false);
if (runner != null) { if (runner != null) {
runner.join(getSweepInterval() * 5); runner.join(getSweepInterval() * 5L);
} }
} }
} }

View File

@ -175,7 +175,7 @@ public class BitArrayBin implements Serializable {
last = list.get(lastBitArrayIndex); last = list.get(lastBitArrayIndex);
if (last != null) { if (last != null) {
result += last.length() -1; result += last.length() -1;
result += lastBitArrayIndex * BitArray.LONG_SIZE; result += lastBitArrayIndex * (long) BitArray.LONG_SIZE;
break; break;
} }
} }

View File

@ -1237,7 +1237,7 @@ public class PageFile {
} }
private long recoveryFileSizeForPages(int pageCount) { private long recoveryFileSizeForPages(int pageCount) {
return RECOVERY_FILE_HEADER_SIZE + ((pageSize + 8) * pageCount); return RECOVERY_FILE_HEADER_SIZE + ((pageSize + 8L) * pageCount);
} }
private void releaseCheckpointWaiter() { private void releaseCheckpointWaiter() {

View File

@ -726,7 +726,7 @@ public class Transaction implements Iterable<Page> {
Long key = page.getPageId(); Long key = page.getPageId();
// how much pages we have for this transaction // how much pages we have for this transaction
size = writes.size() * pageFile.getPageSize(); size = writes.size() * (long) pageFile.getPageSize();
PageWrite write; PageWrite write;

View File

@ -694,7 +694,7 @@ public class MQTTProtocolConverter {
// Client has sent a valid CONNECT frame, we can stop the connect checker. // Client has sent a valid CONNECT frame, we can stop the connect checker.
monitor.stopConnectChecker(); monitor.stopConnectChecker();
long keepAliveMS = keepAliveSeconds * 1000; long keepAliveMS = keepAliveSeconds * 1000L;
LOG.debug("MQTT Client {} requests heart beat of {} ms", getClientId(), keepAliveMS); LOG.debug("MQTT Client {} requests heart beat of {} ms", getClientId(), keepAliveMS);

View File

@ -95,7 +95,7 @@ public class JMSMemtest {
reportName = settings.getProperty("reportName"); reportName = settings.getProperty("reportName");
destinationName = settings.getProperty("destinationName"); destinationName = settings.getProperty("destinationName");
reportDirectory = settings.getProperty("reportDirectory"); reportDirectory = settings.getProperty("reportDirectory");
connectionInterval = connectionCheckpointSize * 1024; connectionInterval = connectionCheckpointSize * 1024L;
} }
public static void main(String[] args) { public static void main(String[] args) {
@ -171,7 +171,7 @@ public class JMSMemtest {
protected boolean resetConnection(int counter) { protected boolean resetConnection(int counter) {
if (connectionInterval > 0) { if (connectionInterval > 0) {
long totalMsgSizeConsumed = counter * 1024; long totalMsgSizeConsumed = counter * 1024L;
if (connectionInterval < totalMsgSizeConsumed) { if (connectionInterval < totalMsgSizeConsumed) {
return true; return true;
} }