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
Is your feature request related to a problem? Please describe.
Can't hit ever hit the second false condition below since it only sets the buffer to inactive or a working buffer (never the same as active):
789 [ + + ][ + - ]: 22 : if ((*WorkingBufferPtr) != NULL &&
790 : 17 : (*WorkingBufferPtr)->BufferPtr != RegRecPtr->Buffers[RegRecPtr->ActiveBufferIndex].BufferPtr)
791 : : {
792 : : /* In case the file contains a partial table load, get the active buffer contents first */
793 : 17 : memcpy((*WorkingBufferPtr)->BufferPtr, RegRecPtr->Buffers[RegRecPtr->ActiveBufferIndex].BufferPtr,
794 : : RegRecPtr->Size);
795 : : }
Describe the solution you'd like
Trade "defensive" programming (avoids memcpy overlap which is undefined behavior) w/ removing the impossible condition check since the only way to reach it would be to introduce a bug.
Describe alternatives you've considered
None
Additional context
None
Requester Info
Jacob Hageman - NASA/GSFC
The text was updated successfully, but these errors were encountered:
skliper
changed the title
TBL unreachable branch in CFE_TBL_GetWorkingBuffer
TBL unreachable branch in CFE_TBL_GetWorkingBuffer and CFE_TBL_UpdateInternal (memcpy overlap avoidance)
Aug 26, 2021
Is your feature request related to a problem? Please describe.
Can't hit ever hit the second false condition below since it only sets the buffer to inactive or a working buffer (never the same as active):
cFE/modules/tbl/fsw/src/cfe_tbl_internal.c
Lines 789 to 795 in 5e41330
Same pattern in CFE_TBL_UpdateInternal
cFE/modules/tbl/fsw/src/cfe_tbl_internal.c
Lines 1008 to 1013 in 5e41330
Describe the solution you'd like
Trade "defensive" programming (avoids memcpy overlap which is undefined behavior) w/ removing the impossible condition check since the only way to reach it would be to introduce a bug.
Describe alternatives you've considered
None
Additional context
None
Requester Info
Jacob Hageman - NASA/GSFC
The text was updated successfully, but these errors were encountered: