[X] Bug exists Release Version 1.2.5 ( Master Branch)
[X] Bug exists in MQTTv5 Client on Snapshot Version 1.2.6-SNAPSHOT (Develop Branch)
The MQTT v5 specification defines the Receive Maximum property as a Two Byte Integer (16-bit unsigned integers).
The Receive Maximum property is currently decoded by a call to DataInput.readShort casted to int (see MqttProperties.decodeProperties). This code interprets any value greater than 32767 as a negative value.
The MqttDataTypes.readUnsignedTwoByteInt method should be used instead.
The same problem is present in the encoding of the value, and presumably in the encoding/decoding of several other values:
length of Auth Data, or Correlation Data (Binary Data, section 1.5.6 of the specification).
value of Topic Alias Maximum, Topic Alias identifier.
The MQTT v5 specification defines the Receive Maximum property as a Two Byte Integer (16-bit unsigned integers).
The Receive Maximum property is currently decoded by a call to DataInput.readShort casted to int (see MqttProperties.decodeProperties). This code interprets any value greater than 32767 as a negative value.
The MqttDataTypes.readUnsignedTwoByteInt method should be used instead.
The same problem is present in the encoding of the value, and presumably in the encoding/decoding of several other values: