Skip to content

Commit

Permalink
Fix #???, add descriptor in SB test case
Browse files Browse the repository at this point in the history
Where an SB UT test case needs to return a local message buffer,
it needs to be preceded by a descriptor as it would be if it had
been allocated from the pool.  This should fix an address sanitizer
report.
  • Loading branch information
jphickey committed Jun 5, 2024
1 parent 505baa1 commit 5e9792a
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions modules/sb/ut-coverage/sb_UT.c
Original file line number Diff line number Diff line change
Expand Up @@ -3633,12 +3633,19 @@ static void SB_UT_PipeIdModifyHandler(void *UserObj, UT_EntryKey_t FuncKey, cons
void * data = UT_Hook_GetArgValueByName(Context, "data", void *);
size_t * size_copied = UT_Hook_GetArgValueByName(Context, "size_copied", size_t *);
int32 status;
static SB_UT_Test_Tlm_t FakeTlmPkt;
static struct
{
CFE_SB_BufferD_t Desc;
SB_UT_Test_Tlm_t content;
} FakeTlmPktD;

SB_UT_Test_Tlm_t ** OutData;
CFE_SB_PipeD_t * PipeDscPtr = UserObj;

memset(&FakeTlmPktD, 0, sizeof(FakeTlmPktD));

OutData = data;
*OutData = &FakeTlmPkt;
*OutData = (void *)&FakeTlmPktD.Desc.Content;
*size_copied = sizeof(*OutData);
status = OS_SUCCESS;
UT_Stub_SetReturnValue(FuncKey, status);
Expand Down

0 comments on commit 5e9792a

Please sign in to comment.