Fix boundary check error in tdbstore causing kv_set failure with max area size
#449
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.
This PR fixes a boundary check error in tdbstore. When
kv_setis called with data exactly equal to the available storage capacity, it erroneously returnsMBED_ERROR_INVALID_DATA_DETECTED. The issue was traced to an off-by-one error in the boundary checking logic. The fix adjusts the condition so that data matching the exact storage boundary is now accepted.The code to reproduce the problem is as follows:
Impact of changes
This bug fix resolves an issue where valid key-value pairs could not be set when using the full storage capacity. There should be no negative impact on users; in fact, the behavior will now correctly reflect the intended design.
Documentation
None
Pull request type
Test results
Sorry, I cannot attach the test results as I only have a Raspberry Pi Pico environment.