Skip to content
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

OSC_INUM_TO_IVEC stub returning stack allocated memory #777

Closed
skliper opened this issue Feb 9, 2021 · 4 comments · Fixed by #778 or #774
Closed

OSC_INUM_TO_IVEC stub returning stack allocated memory #777

skliper opened this issue Feb 9, 2021 · 4 comments · Fixed by #778 or #774
Labels
bug security unit-test Tickets related to the OSAL unit testing (functional and/or coverage)
Milestone

Comments

@skliper
Copy link
Contributor

skliper commented Feb 9, 2021

Is your feature request related to a problem? Please describe.
CodeQL warning on line 72 (returning VecTbl):

OCS_VOIDFUNCPTR *OCS_INUM_TO_IVEC(unsigned int ui)
{
int32 Status = UT_DEFAULT_IMPL(OCS_INUM_TO_IVEC);
OCS_VOIDFUNCPTR *VecTbl;
OCS_VOIDFUNCPTR DummyVec;
size_t VecTblSize;
if (Status == 0)
{
UT_GetDataBuffer(UT_KEY(OCS_INUM_TO_IVEC), (void **)&VecTbl, &VecTblSize, NULL);
if (VecTbl != NULL && ui < (VecTblSize / sizeof(OCS_VOIDFUNCPTR)))
{
VecTbl += ui;
}
else
{
DummyVec = &OCS_intLib_dummyfunc;
VecTbl = &DummyVec;
}
}
else
{
VecTbl = NULL;
}
return VecTbl;
}

Describe the solution you'd like
Make DummyVec static

Describe alternatives you've considered
Remove, no longer used in OSAL testing but could be used by PSP implementations. Leaving in for now.

Additional context
None

Requester Info
Jacob Hageman - NASA/GSFC

@skliper skliper added the unit-test Tickets related to the OSAL unit testing (functional and/or coverage) label Feb 9, 2021
@skliper skliper added this to the 6.0.0 milestone Feb 9, 2021
@astrogeco
Copy link
Contributor

Describe alternatives you've considered
Remove, no longer used in OSAL testing but could be used by PSP implementations. Leaving in for now.

@skliper should we open a separate issue to remove this or port it to PSP?

astrogeco added a commit that referenced this issue Feb 12, 2021
Fix #777, Static allocation of DummyVec in OSC_INUM_TO_IVEC stub
@skliper
Copy link
Contributor Author

skliper commented Feb 12, 2021

@astrogeco Probably not at this point? I'm fine w/o for now. If/when someone needs in a PSP it'll be here/available.

@astrogeco
Copy link
Contributor

I'd like having the issue to remove it so we don't forget

@jphickey
Copy link
Contributor

jphickey commented Feb 12, 2021

I'd like having the issue to remove it so we don't forget

Edit - I should have read previous comments better - moving this to PSP would be fine, as long as we don't delete it (rather not have to reinvent when some PSP uses interrupts and needs a coverage test written)

jphickey pushed a commit to jphickey/osal that referenced this issue Aug 10, 2022
Updates the unit tests, unit test support, and
stubs to replace deprecated SB APIs with MSG APIs.
jphickey pushed a commit to jphickey/osal that referenced this issue Aug 10, 2022
Update documentation to replace deprecated SB
APIs with MSG APIs
jphickey pushed a commit to jphickey/osal that referenced this issue Aug 10, 2022
Update the core software from the deprecated SB
APIs to the MSG APIs.
jphickey added a commit to jphickey/osal that referenced this issue Aug 10, 2022
Fix nasa#777, Use MSG APIs - Core software
Fix nasa#777, Use MSG APIs - Docs
Fix nasa#777, Use MSG APIs - Unit tests

See nasa/cFE#998 for more details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug security unit-test Tickets related to the OSAL unit testing (functional and/or coverage)
Projects
None yet
3 participants