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

CF test passing uninitialized buffer to input-only parameter #47

Closed
jphickey opened this issue Nov 23, 2021 · 0 comments · Fixed by #77
Closed

CF test passing uninitialized buffer to input-only parameter #47

jphickey opened this issue Nov 23, 2021 · 0 comments · Fixed by #77
Milestone

Comments

@jphickey
Copy link
Contributor

This issue was imported from the GSFC issue tracking system

Imported from: [GSFCCFS-1783] CF test passing uninitialized buffer to input-only parameter
Originally submitted by: Hickey, Joseph P. (GSFC-582.0)[VANTAGE SYSTEMS INC] on Tue Nov 16 17:16:22 2021

Original Description:
The test function Test_CF_CFDP_CopyDataToLv_FailsBecause_len_IsEqTo_sizeof_dest_lv_data_Returns_neg1 calls 'CF_CFDP_CopyDataToLv' but passes an uninitialized buffer (arg_data) to the function when this parameter is documented as input only.

The test passes because the value happens to be a "don't-care" in this case, so it does not affect the outcome/operation, but its bad practice to pass uninitialized data to an input, and also some compilers will generate a warning about this too.

Interestingly, the call to 'AnyBufferOf_uint8_WithSize' which would have initialized this, is commented out. This may be a simple mistake - uncommenting this line will resolve the error.

jphickey added a commit to jphickey/CF that referenced this issue Nov 23, 2021
Any data structure passed to a function by pointer
where that pointer is documented as input-only (const)
should always be initialized.  Some compilers will warn
about this (even if the called function does not actively
dereference the pointer due to other constraints).
jphickey added a commit to jphickey/CF that referenced this issue Dec 1, 2021
Any data structure passed to a function by pointer
where that pointer is documented as input-only (const)
should always be initialized.  Some compilers will warn
about this (even if the called function does not actively
dereference the pointer due to other constraints).
astrogeco added a commit that referenced this issue Dec 8, 2021
@skliper skliper added this to the Draco milestone Jan 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants