ARTEMIS-1135: Fix integer multiplication overflows
Multiplication operations where the operands have type `int` but the result is cast to `long` may lead to overflow. Fixes two instances of this problem, by ensuring the operands are cast to `long` during multiplication. This resolves the "Result of integer multiplication cast to long" alerts at https://lgtm.com/projects/g/apache/activemq-artemis/alerts.
This commit is contained in:
parent
5a17fe0804
commit
33c94635bf
|
@ -21,7 +21,7 @@ import org.apache.activemq.artemis.jdbc.store.sql.SQLProvider;
|
|||
|
||||
public class MySQLSQLProvider extends GenericSQLProvider {
|
||||
|
||||
private static final long MAX_BLOB_SIZE = 4 * 1024 * 1024 * 1024; // 4GB
|
||||
private static final long MAX_BLOB_SIZE = 4L * 1024 * 1024 * 1024; // 4GB
|
||||
|
||||
private final String createFileTableSQL;
|
||||
|
||||
|
|
|
@ -165,7 +165,7 @@ public class MQTTProtocolHandler extends ChannelInboundHandlerAdapter {
|
|||
*/
|
||||
void handleConnect(MqttConnectMessage connect, ChannelHandlerContext ctx) throws Exception {
|
||||
this.ctx = ctx;
|
||||
connectionEntry.ttl = connect.variableHeader().keepAliveTimeSeconds() * 1500;
|
||||
connectionEntry.ttl = connect.variableHeader().keepAliveTimeSeconds() * 1500L;
|
||||
|
||||
String clientId = connect.payload().clientIdentifier();
|
||||
session.getConnectionManager().connect(clientId, connect.payload().userName(), connect.payload().password(), connect.variableHeader().isWillFlag(), connect.payload().willMessage(), connect.payload().willTopic(), connect.variableHeader().isWillRetain(), connect.variableHeader().willQos(), connect.variableHeader().isCleanSession());
|
||||
|
|
Loading…
Reference in New Issue