Conversation
…WritePos type for better compatibility
hmueller01
left a comment
There was a problem hiding this comment.
A first glimps over the changes ... lots of good stuff, but still a few changes.
…h and message ID in PubSubClient
…re adequate buffer size for MQTT packets
…ing buffer safety checks and memory management improvements
c3c8dc0 to
a9abbe0
Compare
0178b46 to
ccb047d
Compare
…ion for better clarityCorrection in changelog
|
@hmueller01 I think I finished the modification and ready for your final review if I'm right |
|
Memory usage change @ 2e44c48
Click for full report table
Click for full report CSV |
hmueller01
left a comment
There was a problem hiding this comment.
I proposed a solution, could you check if it is ok for you?
The change looks good for me!
|
Memory usage change @ 433923c
Click for full report table
Click for full report CSV |
|
@MarcAntoineCRUE Somehow |
…loss on network failure
…and maintain consistent state on allocation failure
Sorry for that mistake, I was not able to work on this issue last week, I think it shall be correct now |
|
Thanks for the update! I havn't found time to look into it as well. Will test the PR on a real device the next days. |
|
Memory usage change @ 8d039a5
Click for full report table
Click for full report CSV |
hmueller01
left a comment
There was a problem hiding this comment.
Tested on a real device. Looks good.
|
@TD-er Do you approve the changes as well? |
I will have a look tomorrow as I have not been near a PC in the last few days. |
Summary
This merge request significantly improves the robustness and safety of the PubSubClient library, without changing its public API or breaking existing usage. All changes are fully covered by the test suite (57/57 tests passing).
Key Fixes
The buffer size and pointer are only updated after a successful allocation. If allocation fails, the previous buffer and size remain unchanged, preventing inconsistent internal state.
Rationale
These changes address potential edge cases that could lead to:
All fixes are implemented with minimal code changes and maintain full backward compatibility.