...
The following sequence of operation occurs.
Thread | Queue Before | Operation | Queue After |
|---|---|---|---|
| head -> A -> B -> C -> tail | Enters | head -> A -> B -> C -> tail |
| head -> A -> B -> C -> tail | Removes node A | head -> B -> C -> tail |
| head -> B -> C -> tail | Removes node B | head -> C -> tail |
| head -> C -> tail | Enqueues node A back into the queue | head -> A -> C -> tail |
| head -> A -> C -> tail | Removes node C | head -> A -> tail |
| head -> A -> tail | Enqueues a new node D | head -> A -> D -> tail |
| head -> A -> D -> tail | Thread 1 starts execution | undefined {} |
According to the above sequence of events now head will be pointing to memory which was freed.
...
The likelihood of having a race condition is low. Once the race condition occurs, the reading memory that has already been freed can lead to abnormal program termination or unintended information disclosure.
Guideline | Severity | Likelihood | Remediation Cost | Priority | Level |
|---|---|---|---|---|---|
CON39-C | Medium | unlikely | High | P2 | L3 |
...