Open chk2902 opened 1 year ago
Just to be clear what exactly is the scenario here?
Are you saying you have an app that keeps trying to publish an invalid message and the customer must reinstall your app to clear out the queued message? Where do the "other clients" come into it?
Hello, I also encountered this problem
In the MQTTv3 client, in line 64 of MqttPublish.java.The message producer pushes the message to an illegal topic, causing the consumer client to reconnect. This process is continuous, and it is difficult to analyze which client the error message comes from. I am serious about fixing this vulnerability. It can serve as a means of attack to prevent your consumers from receiving normal message data.
I also encountered this issue.
An MQTT publisher published an illegal topic, which caused the subscriber's thread responsible for reading data to crash.
java Exception in thread "MQTT Rec: test" java.lang.IllegalArgumentException: Invalid UTF-8 char: [0000] at org.eclipse.paho.mqttv5.common.packet.MqttDataTypes.validateUTF8String(MqttDataTypes.java:199) at org.eclipse.paho.mqttv5.common.packet.MqttDataTypes.decodeUTF8(MqttDataTypes.java:157) at org.eclipse.paho.mqttv5.common.packet.MqttPublish.<init>(MqttPublish.java:103) at org.eclipse.paho.mqttv5.common.packet.MqttWireMessage.createWireMessage(MqttWireMessage.java:229) at org.eclipse.paho.mqttv5.common.packet.MqttWireMessage.createWireMessage(MqttWireMessage.java:198) at org.eclipse.paho.mqttv5.client.wire.MqttInputStream.readMqttWireMessage(MqttInputStream.java:131) at org.eclipse.paho.mqttv5.client.internal.CommsReceiver.run(CommsReceiver.java:139) at java.lang.Thread.run(Thread.java:748)
This doesn't make sense。
Please fill out the form below before submitting, thank you!
I use this PAHO client very happily, but now a customer got the message above. This might be a valid cause for an exception, but I don't have a change to "ignore" this crash in my Android app, so the user needs to re-install the app to get rid of the MQTT publishes he configured in my app as they will lead to the crash immediately after startup.
Is there a way to make the client code more "relaxed" about other clients publishing bad message texts to the MQTT server (I have not yet found where the code "0" is, but I guess it's a null terminator at the end of the string, which is included in the text - I don't know much about the inner format of MQTT messages and whether that's likely, but my C++ knowledge with 0-terminated strings forces that guess ;)).
A more tolerant client could help, or a way to "catch" such an event and allow the app to continue without crashing in a thread I did not create. It's OK to close the comm, of course.
I have read
so maybe the way to go is to include an option to be able to ignore the exception and become informed by some clientState event?