-
Notifications
You must be signed in to change notification settings - Fork 204
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix #2488, separate bad argument test #2489
Conversation
eae96f5
to
f83135a
Compare
@@ -56,7 +56,7 @@ | |||
{ | |||
CFE_SB_MsgId_Atom_t msgidval = CFE_SB_MsgIdToValue(MsgId); | |||
|
|||
if (MsgPtr == NULL || msgidval > CFE_PLATFORM_SB_HIGHEST_VALID_MSGID) | |||
if (MsgPtr == NULL || !CFE_SB_IsValidMsgId(MsgId)) |
Check warning
Code scanning / CodeQL
Side effect in a Boolean expression Warning
Pass in CFE_SB_INVALID_MSG_ID separately from a NULL pointer. This also required updates to the way the MSG module checks the MsgID, as it was not using the IsValidMsgID check.
f83135a
to
a9989fb
Compare
@skliper --- do you know why the original "SetMsgId()" only checked against HIGHEST_VALID_MSGID instead of using the check implemented in SB? Was there a justification for having a different/lesser validation of MsgId in this particular code? I'm curious because I don't see any real reason it should be more permissive, yet there seemed to be coverage tests checking for the fact that a msgID value of "0" can be successfully set. |
I think that's just left over from when |
*Combines:* sample_app equuleus-rc1+dev36 sch_lab equuleus-rc1+dev29 to_lab equuleus-rc1+dev38 sample_lib equuleus-rc1+dev2 tblCRCTool equuleus-rc1+dev2 cFS-GroundSystem equuleus-rc1+dev2 elf2cfetbl equuleus-rc1+dev10 cFE equuleus-rc1+dev75 PSP equuleus-rc1+dev38 osal equuleus-rc1+dev33 **Includes:** *sample_app* - nasa/sample_app#226 *sch_lab* - nasa/sch_lab#161 *to_lab* - nasa/sch_lab#186 *sample_lib* - nasa/sample_lib#96 *tblCRCTool* - nasa/tblCRCTool#80 *cFS-GroundSystem* - nasa/cFS-GroundSystem#239 *elf2cfetbl* - nasa/elf2cfetbl#144 - nasa/elf2cfetbl#143 *cFE* - nasa/cFE#2463 - nasa/cFE#2486 - nasa/cFE#2485 - nasa/cFE#2489 *PSP* - nasa/PSP#422 - nasa/PSP#427 *osal* - nasa/osal#1437 - nasa/osal#1442 Co-authored by: Joseph Hickey <jphickey@users.noreply.github.com> Co-authored by: Dylan Baker <dzbaker@users.noreply.github.com>
*Combines:* sample_app equuleus-rc1+dev36 sch_lab equuleus-rc1+dev29 to_lab equuleus-rc1+dev38 sample_lib equuleus-rc1+dev2 tblCRCTool equuleus-rc1+dev2 cFS-GroundSystem equuleus-rc1+dev2 elf2cfetbl equuleus-rc1+dev10 cFE equuleus-rc1+dev75 PSP equuleus-rc1+dev38 osal equuleus-rc1+dev33 **Includes:** *sample_app* - nasa/sample_app#226 *sch_lab* - nasa/sch_lab#161 *to_lab* - nasa/sch_lab#186 *sample_lib* - nasa/sample_lib#96 *tblCRCTool* - nasa/tblCRCTool#80 *cFS-GroundSystem* - nasa/cFS-GroundSystem#239 *elf2cfetbl* - nasa/elf2cfetbl#144 - nasa/elf2cfetbl#143 *cFE* - nasa/cFE#2463 - nasa/cFE#2486 - nasa/cFE#2485 - nasa/cFE#2489 *PSP* - nasa/PSP#422 - nasa/PSP#427 *osal* - nasa/osal#1437 - nasa/osal#1442 Co-authored by: Joseph Hickey <jphickey@users.noreply.github.com> Co-authored by: Dylan Baker <dzbaker@users.noreply.github.com>
*Combines:* sample_app equuleus-rc1+dev36 sch_lab equuleus-rc1+dev29 to_lab equuleus-rc1+dev38 sample_lib equuleus-rc1+dev2 tblCRCTool equuleus-rc1+dev2 cFS-GroundSystem equuleus-rc1+dev2 elf2cfetbl equuleus-rc1+dev10 cFE equuleus-rc1+dev75 PSP equuleus-rc1+dev38 osal equuleus-rc1+dev33 **Includes:** *sample_app* - nasa/sample_app#226 *sch_lab* - nasa/sch_lab#161 *to_lab* - nasa/sch_lab#186 *sample_lib* - nasa/sample_lib#96 *tblCRCTool* - nasa/tblCRCTool#80 *cFS-GroundSystem* - nasa/cFS-GroundSystem#239 *elf2cfetbl* - nasa/elf2cfetbl#144 - nasa/elf2cfetbl#143 *cFE* - nasa/cFE#2463 - nasa/cFE#2486 - nasa/cFE#2485 - nasa/cFE#2489 *PSP* - nasa/PSP#422 - nasa/PSP#427 *osal* - nasa/osal#1437 - nasa/osal#1442 Co-authored by: Joseph Hickey <jphickey@users.noreply.github.com> Co-authored by: Dylan Baker <dzbaker@users.noreply.github.com>
*Combines:* sample_app equuleus-rc1+dev36 sch_lab equuleus-rc1+dev29 to_lab equuleus-rc1+dev38 sample_lib equuleus-rc1+dev2 tblCRCTool equuleus-rc1+dev2 cFS-GroundSystem equuleus-rc1+dev2 elf2cfetbl equuleus-rc1+dev10 cFE equuleus-rc1+dev75 PSP equuleus-rc1+dev38 osal equuleus-rc1+dev33 **Includes:** *sample_app* - nasa/sample_app#226 *sch_lab* - nasa/sch_lab#161 *to_lab* - nasa/sch_lab#186 *sample_lib* - nasa/sample_lib#96 *tblCRCTool* - nasa/tblCRCTool#80 *cFS-GroundSystem* - nasa/cFS-GroundSystem#239 *elf2cfetbl* - nasa/elf2cfetbl#144 - nasa/elf2cfetbl#143 *cFE* - nasa/cFE#2463 - nasa/cFE#2486 - nasa/cFE#2485 - nasa/cFE#2489 *PSP* - nasa/PSP#422 - nasa/PSP#427 *osal* - nasa/osal#1437 - nasa/osal#1442 Co-authored by: Joseph Hickey <jphickey@users.noreply.github.com> Co-authored by: Dylan Baker <dzbaker@users.noreply.github.com>
*Combines:* sample_app equuleus-rc1+dev36 sch_lab equuleus-rc1+dev29 to_lab equuleus-rc1+dev38 sample_lib equuleus-rc1+dev2 tblCRCTool equuleus-rc1+dev2 cFS-GroundSystem equuleus-rc1+dev2 elf2cfetbl equuleus-rc1+dev10 cFE equuleus-rc1+dev75 PSP equuleus-rc1+dev38 osal equuleus-rc1+dev33 **Includes:** *sample_app* - nasa/sample_app#226 *sch_lab* - nasa/sch_lab#161 *to_lab* - nasa/sch_lab#186 *sample_lib* - nasa/sample_lib#96 *tblCRCTool* - nasa/tblCRCTool#80 *cFS-GroundSystem* - nasa/cFS-GroundSystem#239 *elf2cfetbl* - nasa/elf2cfetbl#144 - nasa/elf2cfetbl#143 *cFE* - nasa/cFE#2463 - nasa/cFE#2486 - nasa/cFE#2485 - nasa/cFE#2489 *PSP* - nasa/PSP#422 - nasa/PSP#427 *osal* - nasa/osal#1437 - nasa/osal#1442 Co-authored by: Joseph Hickey <jphickey@users.noreply.github.com> Co-authored by: Dylan Baker <dzbaker@users.noreply.github.com>
*Combines:* sample_app equuleus-rc1+dev36 sch_lab equuleus-rc1+dev29 to_lab equuleus-rc1+dev38 sample_lib equuleus-rc1+dev2 tblCRCTool equuleus-rc1+dev2 cFS-GroundSystem equuleus-rc1+dev2 elf2cfetbl equuleus-rc1+dev10 cFE equuleus-rc1+dev75 PSP equuleus-rc1+dev38 osal equuleus-rc1+dev33 **Includes:** *sample_app* - nasa/sample_app#226 *sch_lab* - nasa/sch_lab#161 *to_lab* - nasa/sch_lab#186 *sample_lib* - nasa/sample_lib#96 *tblCRCTool* - nasa/tblCRCTool#80 *cFS-GroundSystem* - nasa/cFS-GroundSystem#239 *elf2cfetbl* - nasa/elf2cfetbl#144 - nasa/elf2cfetbl#143 *cFE* - nasa/cFE#2463 - nasa/cFE#2486 - nasa/cFE#2485 - nasa/cFE#2489 *PSP* - nasa/PSP#422 - nasa/PSP#427 *osal* - nasa/osal#1437 - nasa/osal#1442 Co-authored by: Joseph Hickey <jphickey@users.noreply.github.com> Co-authored by: Dylan Baker <dzbaker@users.noreply.github.com>
*Combines:* sample_app equuleus-rc1+dev36 sch_lab equuleus-rc1+dev29 to_lab equuleus-rc1+dev38 sample_lib equuleus-rc1+dev2 tblCRCTool equuleus-rc1+dev2 cFS-GroundSystem equuleus-rc1+dev2 elf2cfetbl equuleus-rc1+dev10 cFE equuleus-rc1+dev75 PSP equuleus-rc1+dev38 osal equuleus-rc1+dev33 **Includes:** *sample_app* - nasa/sample_app#226 *sch_lab* - nasa/sch_lab#161 *to_lab* - nasa/sch_lab#186 *sample_lib* - nasa/sample_lib#96 *tblCRCTool* - nasa/tblCRCTool#80 *cFS-GroundSystem* - nasa/cFS-GroundSystem#239 *elf2cfetbl* - nasa/elf2cfetbl#144 - nasa/elf2cfetbl#143 *cFE* - nasa/cFE#2463 - nasa/cFE#2486 - nasa/cFE#2485 - nasa/cFE#2489 *PSP* - nasa/PSP#422 - nasa/PSP#427 *osal* - nasa/osal#1437 - nasa/osal#1442 Co-authored by: Joseph Hickey <jphickey@users.noreply.github.com> Co-authored by: Dylan Baker <dzbaker@users.noreply.github.com>
Checklist (Please check before submitting)
Describe the contribution
Pass in CFE_SB_INVALID_MSG_ID separately from a NULL pointer. This also required updates to the way the MSG module checks the MsgID, as it was not using the IsValidMsgID check.
Fixes #2488
Testing performed
Build and run all tests
Expected behavior changes
CFE_MSG_Init() will now return the BAD_ARGUMENT code if passed CFE_SB_INVALID_MSG_ID. Oddly, this was not the case previously, it would still return CFE_SUCCESS. This is because the MSG implementation wasn't using the same check function (CFE_SB_IsValidMsgID). This PR corrects that.
System(s) tested on
Debian
Additional context
This is correct behavior now, but its one of those things where I can't be totally sure if some app was relying on the incorrect behavior.
Contributor Info - All information REQUIRED for consideration of pull request
Joseph Hickey, Vantage Systems, Inc.