Skip to content

Get text segment stubs seem to be bugged #313

@skliper

Description

@skliper

Describe the bug
Looks like the stubs are checking input values vs successful UT_GetDataBuffer, which doesn't make sense to me since it's used to decide if the buffer values should be used or not:

PSP/ut-stubs/ut_psp_stubs.c

Lines 559 to 570 in 1bd7bd9

UT_GetDataBuffer(UT_KEY(CFE_PSP_GetCFETextSegmentInfo), &TempAddr, &TempSize, NULL);
if (*PtrToCFESegment == 0)
{
/* Backup -- Set the pointer and size to anything */
*PtrToCFESegment = (cpuaddr)&LocalTextSegment;
*SizeOfCFESegment = sizeof(LocalTextSegment);
}
else
{
*PtrToCFESegment = (cpuaddr)TempAddr;
*SizeOfCFESegment = TempSize;
}

PSP/ut-stubs/ut_psp_stubs.c

Lines 604 to 615 in 1bd7bd9

UT_GetDataBuffer(UT_KEY(CFE_PSP_GetKernelTextSegmentInfo), &TempAddr, &TempSize, NULL);
if (*PtrToKernelSegment == 0)
{
/* Backup -- Set the pointer and size to anything */
*PtrToKernelSegment = (cpuaddr)&LocalTextSegment;
*SizeOfKernelSegment = sizeof(LocalTextSegment);
}
else
{
*PtrToKernelSegment = (cpuaddr)TempAddr;
*SizeOfKernelSegment = TempSize;
}

To Reproduce
You'll get an uninitialized error on the input pointer if not already set, if it's nonzero and you don't set the buffer that will utilize the Temp values which doesn't make sense to me.

Expected behavior
Use buffer values if passed in, otherwise use local dummy segment.

System observed on:
N/A

Reporter Info
Jacob Hageman - NASA/GSFC

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions