CWE-366
Race Condition within a Thread
AI Translation Available
If two threads of execution use a resource simultaneously, there exists the possibility that resources may be used while invalid, in turn making the state of execution undefined.
Status
draft
Abstraction
base
Likelihood
medium
Affected Platforms
C
C#
C++
Java
Technical Details
AI Translation
Common Consequences
integrity
other
Impacts
alter execution logic
unexpected state
Detection Methods
automated static analysis
Potential Mitigations
Phases:
architecture and design
Descriptions:
•
Use locking functionality. This is the recommended solution. Implement some form of locking mechanism around code which alters or reads persistent data in a multithreaded environment.
•
Create resource-locking validation checks. If no inherent locking mechanisms exist, use flags and signals to enforce your own blocking scheme when resources are being used by other threads of execution.