docs: verify no padding issues in serialized structs#66
Closed
gdellis wants to merge 1 commit into
Closed
Conversation
Owner
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Audit of structs serialized via
memcpyin the codebase for issue #63.Audit Results
BLE structs (already fixed in PR #52):
BleLocationData(17 bytes) - uses#pragma pack(push, 1), static_assert addedBleAlertData(18 bytes) - uses#pragma pack(push, 1), static_assert addedGPS structs (no issue):
GpsData- Contains only C++ fundamental types (double,uint8_t,uint64_t), no memcpy serialization found. Used internally, not serialized over wire.LoRa structs (no issue):
LoRaPacket- Contains fixed-size array (uint8_t data[255]), no struct memcpy. Uses manual byte copying insend/receivemethods.Manual serialization (verified correct):
try_lora_send()in state_machine.cpp manually copies fields with known sizes (4-byte int32, 2-byte battery, etc.) - no struct padding concerntry_ble_fallback()populatesBleLocationDatafield-by-field, not via memcpyConclusion
No additional structs need
#pragma pack. The BLE structs were the only ones serialized via struct memcpy, and those are already fixed.Closes #63