Race condition in accessing lookup table bwLut from vtkLookupTableMapData() in the TestMedical3 example
This issue was created automatically from an original Mantis Issue. Further discussion may take place here.
ENVIRONMENT Ubuntu 14.04, x86_64
VERSION VTK’s branch master, commit a846baed
STEPS TO REPRODUCE: $ git clone https://gitlab.kitware.com/vtk/vtk.git $ mkdir build $ cd build $ cmake -DBUILD_EXAMPLES=on ../vtk $ ./bin/MedicalExamplesCxxTests TestMedical3 ExternalData/Testing/Data/headsq/quarter -D ExternalData/Testing -T Testing/Temporary -V ExternalData/Examples/Medical/Cxx/Baseline/TestMedical3.png
OBSERVED BEHAVIOR: The test succeeds. However, the software verification tool Pareon Verify (http://pareonverify.com/) reports concurrent reads and writes to the bwLut lookup table from vtkLookupTableMapData() executed in different threads. The detailed error report from Pareon Verify is attached in vtk.bug.rpt. Such concurrent accesses without synchronization constitute a critical race condition that can lead to program crashes and malfunctioning.
EXPECTED BEHAVIOR: Accesses to the bwLut data structure from concurrent threads should be either protected with synchronization or the data structure needs to be duplicated and the algorithm adjusted accordingly.
Since the example is intended to illustrate proper and safe use of VTK, the described above race condition can mislead the end users of the software.