Description
This test case implements a double checked lock around the initialization of a shared struct in an attempt to be efficient. The test case takes a control integer, the names of two control files, and an input string. The control integer and the two control files are used for timing within the test case to ensure that we hit either a good or bad case, and the input string is used as shared data for the threads to act upon. When executing, the test case spawns two threads which in turn attempt to get a shared instance of the input string by calling a double-checked locking function that initializes and/or returns a shared instance of a struct containing the input string. If one thread calls this function while the other one is inside the function initializing the struct it can return an uninitialized copy of the instance to the second thread. This will lead to an access of uninitialized data resulting in a StringIndexOutOfBoundsException.
Metadata
- Base program: Subversion
- Source Taint: SOCKET
- Data Type: STRUCT
- Data Flow: ADDRESS_AS_NONLINEAR_EXPRESSION
- Control Flow: INTERPROCEDURAL_50
Flaws
Test Suites
Documentation
Have any comments on this test case? Please, send us an email.