CWE-366: Race Condition within a Thread

Description

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.

Submission Date :

July 19, 2006, midnight

Modification Date :

2023-10-26 00:00:00+00:00

Organization :

MITRE
Example Vulnerable Codes

Example - 1

The following example demonstrates the weakness.



static int counter = 0;counter++;if (num > foo) foo = num;return foo;int foo = 0;int storenum(int num) {}


new Threader().start();foo = 1;

System.out.println(foo);public void run() {}static int foo = 0;public static void main() {}public static class Threader extends Thread {}public classRace {}

Related Weaknesses

This table shows the weaknesses and high level categories that are related to this weakness. These relationships are defined to give an overview of the different insight to similar items that may exist at higher and lower levels of abstraction.

Visit http://cwe.mitre.org/ for more details.

© cvefeed.io
Latest DB Update: Nov. 21, 2024 13:03