-
Notifications
You must be signed in to change notification settings - Fork 755
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Are there any plans to migrate to exact-width integer types? #227
Comments
I've had no problem using this library, which is also true for many other developers. |
Mainly the following:
This is not to single out embedded Paho, I think all embedded C/C++ code should use fixed-width types where feasible. |
@scaprile I think we might have discovered at least one bug relating to this topic. While the C standard guarantees that |
Yes, either both This issue seems to arise when packets are longer than 16383 bytes; and this is usually not common on 16-bit platforms. I'm curious to know if you are actually having an issue. |
We are working on a proof of concept and the bug came up as part of our internal review of this library.
For the proof of concept this will ring true for us, but for the long run we can't rely on chance to avoid the undefined behaviour of signed integer overflow (e.g. with multiple-pass streaming of a large enough amount of data). |
I guess you don't have 16K+ RAM available to hold 16K MQTT packets on your 16-bit device, so you most likely will need to discard these packets anyway.
Let's see what the maintainer thinks of this issue. |
That's correct.
Thanks for the tip.
That was my intention behind raising this decoding issue. While before it was more about a matter of opinion, now there is at least one concrete example of how fixed-width integer types would prevent bugs across any compatible platform. |
Maybe #238 is of any help for you. |
Btw the current code base don't even compile for a 16 bit platform. |
Perhaps you should define "compile" and "16-bit platform", this is a fairly mature project and has been developed when C89 dominated the embedded C world. Many sections assume 32-bit wrt your Anyway, the maintainer will decide eventually. |
The definition of "compile" is very easy: take a C compiler and try to translate the source code into binaries. The term 16-bit platform is also very well defined: a computer architecture where the width of an integer or address has a width of 16 bit. If you try to take a compiler for such a platform the comparison in https://github.com/eclipse/paho.mqtt.embedded-c/blob/master/MQTTPacket/src/MQTTPacket.c#L93 will fail.
Interesting, given the fact that the first MQTT specification has only been released in 1999. Even more interesting that back in these days 32 bit architectures were hardly available for microcontrollers.
That's not correct.
I'm under the impression there are no maintainers for this project any more given the fact that no pull request has been properly reviewed in the last couple of years - let alone be merged. |
Oh, I do love irony and sarcasm too. Unfortunately, I can't afford the time. Since you do know for sure, you'll have no issues. |
Maybe you'll find the time if you refrain from wasting it for passive-aggresive and non-helpful comments. Good luck! |
Thank you to all contributors of this code base.
Unfortunately due to the lack of exact-width integer types (e.g.
uint16_t
), this library is difficult to adopt without potential further rework for each platform it is deployed on.Are there any plans to adopt usage of
<stdint.h>
and migrate to exact-width integer types (so as to become more platform agnostic)?The text was updated successfully, but these errors were encountered: