You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
The CFE_SB_MsgHdrSize() function returns a size_t value. Therefore, there is no provision/possibility for an error to be returned.
However, if passed a NULL argument, this still attempts to return CFE_SB_BAD_ARGUMENT which will be implicitly converted to a size_t value - which is platform-defined. Notably, since size_t is unsigned, the result is always positive (success range) and will not be correctly interpreted by the caller.
To Reproduce
Call CFE_SB_MsgHdrSize() with a NULL MsgPtr argument.
Expected behavior
This function should probably return 0 instead of CFE_SB_BAD_ARGUMENT in this case.
Cannot return CFE status codes from a function that does not return CFE_Status_t (or int32).
Additional context
This line was also not being covered by the coverage test (#471) and the return type mismatch prevents this from being covered properly.
Reporter Info
Joseph Hickey, Vantage Systems, Inc.
The text was updated successfully, but these errors were encountered:
Describe the bug
The
CFE_SB_MsgHdrSize()
function returns asize_t
value. Therefore, there is no provision/possibility for an error to be returned.However, if passed a NULL argument, this still attempts to return
CFE_SB_BAD_ARGUMENT
which will be implicitly converted to asize_t
value - which is platform-defined. Notably, sincesize_t
is unsigned, the result is always positive (success range) and will not be correctly interpreted by the caller.To Reproduce
Call
CFE_SB_MsgHdrSize()
with a NULLMsgPtr
argument.Expected behavior
This function should probably return 0 instead of
CFE_SB_BAD_ARGUMENT
in this case.Cannot return CFE status codes from a function that does not return
CFE_Status_t
(orint32
).Code snips
cFE/modules/sb/fsw/src/cfe_sb_util.c
Lines 54 to 57 in 2afdbc1
System observed on:
Ubuntu
Additional context
This line was also not being covered by the coverage test (#471) and the return type mismatch prevents this from being covered properly.
Reporter Info
Joseph Hickey, Vantage Systems, Inc.
The text was updated successfully, but these errors were encountered: