BaseDeprecated

CWE-365DEPRECATED: Race Condition in Switch

Category: logic

Description

This entry has been deprecated. There are no documented cases in which a switch's control expression is evaluated more than once. It is likely that this entry was initially created based on a misinterpretation of the original source material. The original source intended to explain how switches could be unpredictable when using threads, if the control expressions used data or variables that could change between execution of different threads. That weakness is already covered by CWE-367. Despite the ambiguity in the documentation for some languages and compilers, in practice, they all evaluate the switch control expression only once. If future languages state that the code explicitly evaluates the control expression more than once, then this would not be a weakness, but the language performing as designed.

References

  1. https://cwe.mitre.org/data/definitions/365.html

Related by meaning· 6

Nearest entities by semantic similarity across the cs-graph corpus.

CWE
Race Condition within a Thread
CWE
DEPRECATED: State Synchronization Error
CWE
Context Switching Race Condition
CWE
Missing Default Case in Multiple Condition Expression
CWE
Race Condition for Write-Once Attributes
CWE
Omitted Break Statement in Switch
Sourced from MITRE CWE 4.20. Curated for EU compliance use cases by Adam Lundqvist, Founder at SQUR.