Protocol uses the if-condition if !active {...}
during removing an active element from the linked list to handle the situation properly if an inactive element by mistake (or any other bugs) is present in the linked list. But, it is not handling properly, and it leads to two situations:
The wrong inactive element would not be unlinked.
The active element after the to-be-removed element becomes unlinked.
During whitelisting a collection from true
to false
, it iterates over all the elements to reach to the element which is going to be removed.
If between these iterations, it reaches to an element which is not active, it simply breaks the loop.
Then, the statement after the loop would be executed that simply sets the to-be-removed element to false.
The issue is that:
- the inactive element which was reached in between is not corrected.
- the element after the to-be-removed element would become un-linked.
Suppose the linked list is as follows:
collection1: true, next: collection2
collection2: false, next: collection3
collection3: true, next: collection4
collection4: true, next: 0
The goal is to set collection3 to false. During the iteration, when it reaches to collection2, due to its inactivity, it breaks the loop. Then, the state of the collection3 is changed to false, moreover collection4 becomes unlinked. The final status would be:
collection1: true, next: collection2
collection2: false, next: collection3
collection3: false, next: 0
collection4: true, next: 0
The correct status when the body of if !active {...}
is executed should be:
collection1: true, next: collection4
collection2: false, next: 0
collection3: false, next: 0
collection4: true, next: 0
Please note that, it must never happen to have an inactive element in the linked list, in other words, the body of if !active {...}
should never be executed. If it happened, it means another part of the code is broken. If for any reason (other part of the code is buggy, or an update misconfigures the list) the body of if !active {...}
is executed to handle the buggy situation properly, but it leads to other bugs.
Breaking the linked list.
Following is recommended:
Or simply instead of breaking, assert
should be used:
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.