-
Notifications
You must be signed in to change notification settings - Fork 20
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
SC_LoadAts_Test_AtsEntryOverflow Unit Test indexes past array bounds #80
Comments
Just ran into this myself, should be |
skliper
added a commit
to skliper/SC
that referenced
this issue
Jul 26, 2023
skliper
added a commit
to skliper/SC
that referenced
this issue
Jul 26, 2023
skliper
added a commit
to skliper/SC
that referenced
this issue
Jul 26, 2023
skliper
added a commit
to skliper/SC
that referenced
this issue
Jul 26, 2023
…ates result verification
skliper
added a commit
to skliper/SC
that referenced
this issue
Jul 26, 2023
skliper
added a commit
to skliper/SC
that referenced
this issue
Jul 26, 2023
skliper
added a commit
to skliper/SC
that referenced
this issue
Jul 26, 2023
skliper
added a commit
to skliper/SC
that referenced
this issue
Jul 26, 2023
skliper
added a commit
to skliper/SC
that referenced
this issue
Jul 26, 2023
…ates result verification
skliper
added a commit
to skliper/SC
that referenced
this issue
Jul 26, 2023
2 tasks
dzbaker
added a commit
that referenced
this issue
Aug 31, 2023
Fix #80, Unit tests read past array bounds and general cleanup
2 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Checklist (Please check before submitting)
Describe the bug
The
SC_LoadAts_Test_AtsEntryOverflow
unit test indexes past array boundaries.There are two arrays that get indexed improperly, both in
unit-test/sc_loads_tests.c
:uint32 SC_APP_TEST_GlobalAtsCmdStatusTbl[SC_NUMBER_OF_ATS * SC_MAX_ATS_CMDS];
SC_LoadAts_Test_AtsEntryOverflow
, named:uint32 AtsTable[SC_ATS_BUFF_SIZE32];
In
SC_LoadAts_Test_AtsEntryOverflow
, local variablej
gets increased to a value of4005
. This variable is used to index into both of the above arrays. These accesses are indirect, through these pointers:SC_OperData.AtsCmdStatusTblAddr
SC_OperData.AtsTblAddr
Also, I'm not sure if I'm understanding the test correctly, but it seems like
i
should be used instead ofj
, when initializing theAtsCmdStatusTblAddr
array. Perhaps it would help to use more verbose variables thani
andj
.To Reproduce
j
before eachExpected behavior
All of these out-of-bound accesses seem invalid, and should be able to be removed.
This unit test should probably be revised and cleaned up anyway. For example, after the initial
for
loop, the test describes that its intending to fill the (one) last entry with an invalid value. However, what the actual test attempts to do is initialize two entries (not one).Additionally, this unit test doesn't do much verification of
SC_LoadAts
to confirm that the function worked as expected. I'd expect more than just a singleUtAssert_True(call_count_CFE_EVS_SendEvent == 0,
call.Code snips
System observed on:
Additional context
This issue only seemed to pop up when we built the linux target for a 32-bit linux executable, with
-m32
.Reporter Info
Keegan Moore
NASA/GSFC
The text was updated successfully, but these errors were encountered: