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

FS CFE_FS_ParseInputFileNameEx missing branch coverage (defensive condition check) #1883

Open
skliper opened this issue Aug 25, 2021 · 1 comment

Comments

@skliper
Copy link
Contributor

skliper commented Aug 25, 2021

Is your feature request related to a problem? Please describe.
Non-independent conditions checked in CFE_FS_ParseInputFileNameEx:

while (InputPtr != NULL && Component < END_COMPONENT)

Since when processing EXTENSION_COMPONENT (the case before END_COMPONENT) the InputPtr is set to NULL:

case EXTENSION_COMPONENT:
/* Intentional fall through to default case */
default:
/* Just consume the rest of input -
* should already be pointing to correct data */
ComponentTerm = 0;
ComponentLen = InputLen;
ComponentPtr = InputPtr;
InputPtr = NULL; /* no more input */
InputLen = 0;
break;

Describe the solution you'd like
Trade the usefulness of testing for an unreachable condition. It's "defensive" but only reachable by changing the implementation, although it can't cause harm.

Describe alternatives you've considered
None

Additional context
None

Requester Info
Jacob Hageman - NASA/GSFC

@skliper skliper changed the title FS CFE_FS_ParseInputFileNameEx missing branch coverage FS CFE_FS_ParseInputFileNameEx missing branch coverage (defensive condition check) Aug 26, 2021
@avan989
Copy link
Contributor

avan989 commented Jun 2, 2023

With the current implementation, the loop will exit before the Component reaches "END_COMPONENT" making this branch unreachable. Recommend closing tickets (and if needed open a new ticket to change implementation). @dmknutsen @dzbaker

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants