-
Notifications
You must be signed in to change notification settings - Fork 46
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 method CF_CList_Remove appears to accept bad arguments #27
Comments
Note is initialized as node->next = node-prev = node here: Lines 43 to 47 in 593d61a
Node insert front either keeps as is (first) or updates both: Lines 68 to 69 in 593d61a
Note insert back either sets both or uses as is (first): Lines 101 to 104 in 593d61a
Insert after, same pattern: Lines 185 to 188 in 593d61a
There is no case where only one of next or prev == node possible in the code, since these are internal functions there's no requirement to protect from an impossible case. Closing as wontfix. |
Actually, makes more sense to me to remove the redundant conditional... just check if next == node which then removes the need for the strange test. |
This issue was imported from the GSFC issue tracking system
Imported from: [GSFCCFS-1719] CF method CF_CList_Remove appears to accept bad arguments
Originally submitted by: Gibson, Alan S. (GSFC-5870) on Thu Aug 26 13:23:38 2021
Original Description:
A bad node is passed to CF_CList_Remove, but it carries on unaware. This was found because branch 3 of
if((node->next==node)&&(node->prev==node))
can only be covered by a test that passes this situation, node->next == node, node->prev != node.The issue: should a single node enter, that has a node->next == node (meaning: pointing to itself), but a node->prev != node (meaning: NOT pointing to itself), the code continues as if this is a valid state. It may be impossible for a bad node to enter here, but that is not apparent at the unit test level for CF_CList_Remove nor is the Doxygen brief clear on that assumption.
The text was updated successfully, but these errors were encountered: