eclipse-paho / eclipse-paho/paho.mqtt.java
[BUG] RECEIVE_MAXIMUM, TOPIC_ALIAS should be unsignedShort
- Dominant language
- Java
- Stars
- 2.3k
- Forks
- 919
- PR merge metrics
- No merged PRs in 30d
Description
Please fill out the form below before submitting, thank you!
- [x] Bug exists Release Version 1.2.5 ( Master Branch)
- [ ] Bug exists in MQTTv3 Client on Snapshot Version 1.2.6-SNAPSHOT (Develop Branch)
- [x] Bug exists in MQTTv5 Client on Snapshot Version 1.2.6-SNAPSHOT (Develop Branch)

According to the MQTT 5.0 protocol, RECEIVE_MAXIMUM should be in the range [0, 65535], but when the property is resolved, readShort() is used, which causes the range to be [-32768, 32767].
For example, if the server sends 65535(0xFFFF), the parsing will overflow and RECEIVE_MAXIMUM will be -1.
TOPIC_ALIAS_MAXIMUM and TOPIC_ALIAS the same as RECEIVE_MAXIMUM.
Contributor guide
Research direction
Start by locating the MQTTv5 property-resolution path that uses readShort() for RECEIVE_MAXIMUM, TOPIC_ALIAS_MAXIMUM, and TOPIC_ALIAS. Compare its handling with the MQTT 5.0 unsignedShort range and inspect nearby parsing tests or callers. Done means values through 65535 parse without signed overflow, with regression coverage.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- networking
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 50/100