HARD FAULT: Add sanity check to sx126x driver when handling retention list #72
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
If an invalid value is read and present in buffer[0], then :
here happens reading out of bounds of the buffer[] array.
Even more - the buffer[0] is made on stack:
Which is ok, but in combination with the bug above and with the fact, that the stack is in 99.9% cases placed at the end of the RAM, this will cause reading values in an address which is out of bound of RAM/SRAM and therefore a hardfault/memfault/crash will be generated.
The issue can happen and an invalid value can be read out of SX1261 due to power variation, EMC, etc.. and happened to me, when stressing and testing my hardware and generating variations of power of SX1261 close to the allowed voltage area.
This should not happen during normal operation, but it CAN happen - and it is not ok to take down the whole microcontroller system in that case.