Add address sanitizer to CI Pipeline
Checklist (Please check before submitting)
- [X] I reviewed the Contributing Guide.
- [X] I reviewed the cFS README.md file to see if the feature is in the major future work.
- [ X I performed a cursory search to see if the feature request is relevant, not redundant, nor in conflict with other tickets.
Is your feature request related to a problem? Please describe. Enabling address sanitizer can catch several memory issues in C programming.
Describe the solution you'd like If possible i would like to see the address sanitizer added to the cfs pipeline CI pipeline.
Prior to make prep you would add the following exports.
export CFLAGS="-fsanitize=address -fno-omit-frame-pointer -g"
export CXXFLAGS="-fsanitize=address -fno-omit-frame-pointer -g"
export LDFLAGS="-fsanitize=address"
I belive you would make these changes to these two CI Workflows.
https://github.com/nasa/cFE/blob/main/.github/workflows/functional-tests.yml#L61 https://github.com/nasa/cFE/blob/main/.github/workflows/code-coverage.yml#L64
Requester Info Samuel Price
Modify Memory Handling in EVS
// In EVS module source file #include <string.h>
void EVS_SendEvent(uint32 EventID, uint16 EventType, const char *Spec, ...) { if (Spec == NULL) { CFE_EVS_SendEvent(EventID, EventType, "Invalid format string"); return; } // Existing code to handle event }
- Explanation
What this does: Adds a null check for the format string (Spec) before proceeding with event handling.
Why this fixes it: Prevents segmentation faults caused by dereferencing null pointers.
Next steps: Implement similar null checks in other parts of the EVS module.
- Git Commands
git checkout -b fix/evs-segmentation-fault
Modify EVS source file as described above
git add path/to/evs/source/file git commit -m "Fix segmentation fault in EVS module by adding null check" git push origin fix/evs-segmentation-fault